Java Interviews Question
=======================================
Success of Your life.These website will provides the latest technology and also provide the development of programming logic. computer science branch this website is very important. Every day practice code and developed the logic.
1. Which language you know very well. Ans: Sir, I know java language very well. 2.What is Inheritance in java and also types of in
inheritance.
Ans: The process of creating a new class extend and
implement the type,property,behavier of
already existing object in our class that techniques
is called a inheritance. Actually java support 3- types of in heritance in java. A. Single inheritance B. Multi-level inheritance C. Hierarical inheritance Java Does not support D.Hybrid inheritance E.Multiple inheritance 3. Why java not support multiple in Heritance. Ans: suppose you have a one class . this class extending the two other class . two other class having the same signature of method. so, java confused which class method i am going to execute that's why java does't support multiple inheritance. if you try to do like that. than you have to go for interface . otherwise you got Ambigus problam in java. 4.Can you Write a program to find the Palindrome number. Ans: yes sir, import java.util.Scanner; class Palindrome { public static void main(String[] args) { Scanner sc=new Scanner(System.in); System.out.println("Enter the Number:"); int n=sc.nextInt(); int m=n; int sum=0; int rem=0; while(n!=0){ rem=n%10; sum=sum*10+rem; n=n/10; } if(sum==m) System.out.println("Palindrome Number"); else System.out.println("Not palindrome Number"); } } 5.What is the used of super and this keyword in java. Ans: Super keyword is used to access the super class member and this keyword used to access the current class members in java. 6.What is Encapsulation in java. Ans: The process to binding the Data member and member function in one unit and provide the access data member with the help of method that is called the Encapsulation. For Example- create all Data member in the class with private and create the setter and getter method that is called Encapsulation. 7.You know collection .Waht is the used of ArrayList Ans: yes sir. The used of arraylist is storing the collection of object Hectrogenious,homogineous unique, duplicate in java. You can access the values in the ArrayList very easily. it will provide the indexing. also storing the object in inserction order. It is not thread shafe so, multiple Thread can access the same object and modify the values in ArrayList at time. ArrayListarr=new ArrayList<>(); 8.What is method overloading in java. Ans: If we create multiple method with same name but different parameter,order and type that is called the method overloading in java. Method overloading can be possible in one class and super & subclass also. 9.Why Object is super class of all the classes. Ans: Actually Object having the common property of all the sub classes and object. that's why sun microsystem define this Object class is by default super class of all the classes. Object class having a all method used for subclass. Common to all object method is avilable in the super class Object. 10.What is the used of LinkList in java.
Comments
Post a Comment