Saturday, 14 March 2015

Java Interview Questions

1.       What is the advantage of a network
2.       What is the most widely used protocol in the net
3.       What is the difference b/w executable file and .class file
4.       Why java is suitable for net
5.       Why pointers are eliminated from java
6.       What is difference b/w function and method
7.       Is java purely object oriented programming language or not
8.       What part of JVM will allocate memory for java program
9.       Which algorithm is used by garbage collector to remove the unsaved data in the variables or objects from memory
10.   How can we call the garbage collector
11.   What is JIT compiler
12.   What is an API document
13.   What is difference b/w #include and import
14.   What happened if string[] args is not written in main()
15.   What is the difference b/w print and println
16.   What is the difference b/w float and double
17.   What is a Unicode system
18.   How the positive and negative numbers represent in the memory
19.   What is difference b/w >> and >>>
20.   What are the control statements
21.   Do while and while which statement is efficient
22.   Why go to statement is not available in java
23.   What is a collection
24.   What is difference b/w return and system.exit(0)
25.   What is difference b/w system.exit(0) and system.exit(1)
26.   What is difference b/w sysout and syserr
27.   On which memory arrays are created in java
28.   Can we call main() of a class from other class
29.   Is string is a class or data type
30.   Can we call class as data type
31.   What is object reference
32.   What is difference b/w == and equals()
33.   What is string constant pool
34.   What is difference b/w String s="hello" and String s1=new String();
35.   What is difference b/w string and stringbuffer
36.   Are there any classes exist whose objects are immutable in java
37.   What is difference b/w String buffer and String builder
38.   What is Object oriented approach
39.   What is difference b/w object oriented programming and object based programming
40.   What is hash code
41.   How can you find the hash code
42.   Can you declare class as private
43.   When the constructor is called before or after the object is created
44.   What is the difference b/w constructor and method
45.   What is constructor overloading
46.   What is instance method
47.   What is static method
48.   What is difference b/w instance variable and class variable
49.   Why instance variables are not available in static methods
50.   Is it possible to write java program without main()
51.   How can we pass objects to main
52.   In how many ways can we create objects in java
53.   What is object graph
54.   What is anonymous inner class
55.   What is inheritance
56.   Why super class variables available to sub classes
57.   What is advantage of inheritance
58.   Why multiple inheritance is not available in java
59.   How many types of inheritances are there
60.   What is coercion
61.   What is conversion
62.   What is method signature
63.   What is method over loading
64.   What is method overriding
65.   What is difference b/w method overriding and method overriding
66.   Can we override private methods
67.   Can we take private and final methods are same
68.   What is final
69.   What is difference b/w static and dynamic polymorphism
70.   What is difference b/w primitive and advanced data types
71.   What is implicit casting
72.   What is explicit casting
73.   What is widening
74.   What is narrowing
75.   What is super class for all the classes in java
76.   which method is used in cloning
77.   Can we write an interface without any methods
78.   What do we call if interface is not having any methods
79.   What is abstract method
80.   What is abstract class
81.   can we declare a class as abstract and final
82.   What is interface
83.   Why abstract class methods are public and abstract by default
84.   can you implement one interface with another interface
85.   Can we write a class with in interface
86.   What is difference b/w abstract class and interface
87.   What happened when we create main method without string[] args
88.   What is checked exception
89.   What is throwable
90.   What is super class for all exceptions
91.   What is difference b/w exception and error
92.   What is difference b/w throes and throw
93.   Is it possible to re throw an exception
94.   Why do we need wrapper class
95.   What is boxing
96.   what is un-boxing
97.   What happened if we pass String to parseInt().
98.   What is collection framework
99.   IS collection framework store the copy of variable or its reference
100.                        Can we store primitive data types in collections
101.                        What is difference b/w Iterator and ListIterator
102.                        What is difference b/w iterator and enumerator
103.                        What is auto boxing
104.                        What is difference b/w stack and linked list
105.                        What is difference b/w array list and vector
106.                        Can we synchronize array list
107.                        What is load factor of hash map and hash table
108.                        What is difference b/w hash map and hash table
109.                        Can we make hash map is synchronized
110.                        What difference b/w set and list
111.                        What is advantage of stream classes
112.                        Which type of variables cannot be serialized
113.                        What is serialization
114.                        Which thread run always in java
115.                        Why threads are called light weight
116.                        What is single tasking and multi tasking
117.                        How can you stop a thread
118.                        What is difference b/t extends thread and implement runnable
119.                        Which method is executed by thread default
120.                        What is thread synchronization
121.                        What is difference b/w synchronized block and synchronised method
122.                        What is thread dead lock
123.                        What is difference b/w sleep and wait methods
124.                        what is default priority of a thread
125.                        What is daemon thread
126.                        Thread life cycle
127.                        What is generic type




1.       aabccdee Find the used alphabets as abcde ?
2.       If I will write String s=new String("XYZ"); String s1=new String("XYZ"); if(s.equals(s1)){ sop("True"); } else{ sop("False"); } This program will give me "True". But When I am creating my own class suppose class Employee{ public Employee(String name); } Employee e= new Employee("XYZ"); Employee e1 = neew Employee("XYZ"); if(e.equals(e1)){ sop("True"); } else{ sop("False"); } Then it will give the output as "False". Can I know what is happening internally
3.       How to Sort list of Strings in ascending order without using java api.
4.       How to Sort Strings which are given in List and display in ascending order without using java api.
5.       explain how many oops concepts available in java with realtime scenarios?
6.       What is the alternate of 'Inheritance' ?
7.       In Inheritance if we are implementing Multi level inheritance and all class having same name of variable and now i want to access each class variable and how it is possible?
8.       how system.out.println() works?
9.       what is mean by thread lock?
10.   what is mean by synchronization?
11.   How HashMap implemented in java? how it internally works when values are added or searched from hashMap?What is the difference betweenthe implementation of hashmap and Linked Hashmap?
12.   while creating thread why we extend thread class
13.   whether java is fully object oriented language or partially object oriented language
14.   Why should we create an object? what is a need of it? Apart from access members of a class i want what is a need of object what does it contain?? In normal class to access any member of thaht class we create object where as for static class we access its members using class name. what is a difference between them... thanks in advance.
15.   any other way to print the text without using System.out.println() in java?
16.   what should do when using multiple catch() block & what should never do for the same?
17.   when there is a need of jvm then how we can say that java is a platform independent language?
18.   what are the rules to use try catch finally?
19.   Why we need Finally with try? pls expain with ur example..
20.   If circular link of two objects, then will it be garbage collected ?
21.  What is the difference between method and constructor ?
22.   Difference between Primary key and unique key?
23.   Infinite loop using while ?
24.   what is difference between Interface and abstract class
25.   Ducking is automatic in checked exception?True or false
26.   Difference between Map & Hashmap
27.   Superclass of exception
28.   Difference between error and exception
29.   Difference between abtsract & final
30.  what is deadlock in threads? with example
31.   what is data binding? give the example
32.   what is the difference b/w static and final methods?
33.   what is different between static and non static methods ,using example
34.   why string constant pool in java
35.   why HashTable not allow null key and value
36.   difference between vectorlist and hash
37.   There are 100 keys and values in HashMap.how to get the keys and values?
38.   can any one send me the example program of immutable class?
39.   Can there be an abstract class with no abstract methods in it?
40.   what is the difference between System.exit() and System.exit(1)?
41.   what is the main differene between synchronize() method and Synchronize{}block?
42.   can we write two same methods in outer class and innerclass.
43.   Why wait(),notify(),notifyAll() methods defined in Object class althought we are using in only threads.
44.   How can we get one Interface methods whit out using implementation of interface
45.   What is the difference between static synchronize() metod and synchronize() method?
46.   What is basic concept of static in java ?
47.   When should I use abstract classes and when should I use interfaces?
48.   When we r go to abstract class and when we go to Interface? i have confusion this question while in interview plz clarify
49.   What is the difference(or similarity if there are some) between object and a variable?
50.   how to call one program .class file in another program
51.   What are the override methods in Object class?
52.   what is singlton class?where it is use in real time senario.
53.   Why java is free from garbage values??
54.   Why does java doesnt suuport unsigned values?
55.   What does those terms actually mean included in the j.d.k i.6?
56.   Why does java doesnot support multiple inheritance?
57.   how to java plateform independent?
58.   What is the difference between Object and Instance?
59.   Can a class be subclass of itself?
60.   If goto and const is reserve words than why it is not work in java?
61.   what is the reason behind non static method cannot be referenced from a static Context?
62.   Why does java not allow multiple public classes in a java file ?
63.   does java support default argument in Method?
64.   where final and static variable stored?
65.   Hi friends i want display Triangle shap stars(*) please can tell me any one java code logic? * *** ***** ******* Like this
66.   How to print a statement without using semicolan in java
67.   What is Yield() method when we r using this ? tell exactly
68.   can write code for serialization 
69.   make a method which any number and any type of argument and print sum of that arguments.....
70.   Can we override the main method?
71.   we cannot create an object of interface but we can create a variable of it
72.   how to execute main()
73.   how to make hashmap object as synchronized object?
74.   What is the exact difference in between Unicast and Multicast object?
75.   explain about method overloading and method overriding with difficult examples
76.   briefley expalin about the packages
77.   difference throws and throw in java
78.   what is mena by object block any what is the use of that
79.   Definition for connection pooling?
80.   What is the reason that multiple inheritance is not possible in java?
81.   Difference between hashCode() & equals()?
82.   How to Create A Wapper Class in core Java and Why are Use in java?
83.   How to extract HashMap values?
84.   please write java program of instanceOf keyword implementation
85.   wat is final...? wat is finally...? wat is finalize....? difference between " final and finally and finalize "...?
86.   why operator overloading is removed in java?
87.   what is the difference between String and StringBuffer classes?
88.   What is an anonymous class?
89.   Why transient variables wont participate in serialization?
90.   How can u create the Object of class Without using "New" opertor?
91.   Can any one say how will sort map objects in java?
92.   What is abstraction with strong example program
93.   why an outer class cannot be declared as private?
94.   how copy the hashmap object into arraylist at java program?
95.   is set interface synchronized by default?
96.   how we can write the string concatenation program in java.
97.   Can we extend the String class?
98.   what is the use of StringBuffer?
99.   int a=1,b=10; System.out.println(a+b--);
100.                        explain how many oops concepts available in java with realtime scenarios?
101.                        What is the alternate of 'Inheritance' ?
102.                        In Inheritance if we are implementing Multi level inheritance and all class having same name of variable and now i want to access each class variable and how it is possible?
103.                        how system.out.println() works?
104.                        what is mean by thread lock?
105.                        what is mean by synchronization?
106.                        How HashMap implemented in java? how it internally works when values are added or searched from hashMap?What is the difference betweenthe implementation of hashmap and Linked Hashmap?
107.                        while creating thread why we extend thread class
108.                        whether java is fully object oriented language or partially object oriented language
109.                        Why should we create an object? what is a need of it? Apart from access members of a class i want what is a need of object what does it contain?? In normal class to access any member of thaht class we create object where as for static class we access its members using class name. what is a difference between them
110.                        any other way to print the text without using System.out.println() in java?
111.                        what should do when using multiple catch() block & what should never do for the same?
112.                        when there is a need of jvm then how we can say that java is a platform independent language?
113.                        what are the rules to use try catch finally?
114.                        What is the difference between method and constructor ?
115.                        Difference between Primary key and unique key?
116.                        Infinite loop using while ?
117.                        what are the design patterns in struts?
118.                        what is difference between Interface and abstract class
119.                        FOR EXAMPLE WE R HAVING TWO LIST ELEMENTS ..BOTH LISTS CONTAINS ID,NAME,PLACE ..I NEED TO COMPARE BOTH IDS IN TWO LISTS,IF ID'S R SAME MEANS WE HAVE ADD THE DETAILS(LIKE NAME,PLACE) TO MAP...HOW IS POSSIBLE ?CAN ANY ONE SUGGEST?
120.                        Difference between Map & Hashmap
121.                        Superclass of exception
122.                        Difference between error and exception
123.                        Difference between abtsract & final
124.                        what is deadlock in threads? with example
125.                        what is data binding? give the example
126.                        what is the difference b/w static and final methods?
127.                        Which collection object is faster to retrieving the data and inserting the data into it.
128.                        what is different between static and non static methods ,using example
129.                        is it mandatory to deaclare all variables public static fianl in interfaces?if i declare like in the below program, public interface A { public static final int I=0; int j=0; } in interface A,what is the difference between I,j?
130.                        I Have a class abstract with one abstract method, so that method should override in the subclass, but i dont want to override, if i am not override what will happen? If compilation will occur then i dont want to give compilation error, then what we need to do??? See the sample program. public abstract class AbstractExample { public abstract void sampleMethod(); } public class AbstractExampleImple extends AbstractExample { }
131.                        The following program is Overloading or Overriding? public class PolymorphismEx { public int sampleMethod(int a) { return a; } public String sampleMethod(int a) { return "Is it Overloading or Overriding???"; } }
132.                        why top level class could not be static
133.                        why string constant pool in java
134.                        why HashTable not allow null key and value
135.                        difference between vectorlist and hash
136.                        There are 100 keys and values in HashMap.how to get the keys and values?
137.                      immutable class?
138.                        Can there be an abstract class with no abstract methods in it?
139.                        what is the difference between System.exit() and System.exit(1)?
140.                        Which is the best way of exception handling?
141.                        what is the main differene between synchronize() method and Synchronize{}block?
142.                        can we write two same methods in outer class and innerclass.
143.                        Why wait(),notify(),notifyAll() methods defined in Object class althought we are using in only threads.
144.                        How can we get one Interface methods whit out using implementation of interface
145.                        What is the difference between static synchronize() metod and synchronize() method?
146.                        What are the override methods in Object class?
147.                        what is singlton class?where it is use in real time senario.
148.                        Why does java doesnot support multiple inheritance?
149.                        how to java plateform independent?
150.                        What is the difference between Object and Instance?
151.                        Can a class be subclass of itself?
152.                        what is the reason behind non static method cannot be referenced from a static Context?
153.                        Why does java not allow multiple public classes in a java file ?
154.                        does java support default argument in Method?
155.                        where final and static variable stored?
156.                        How to print a statement without using semicolan in java
157.                        What is Yield() method when we r using this ? tell exactly
158.                        can write code for serialization ?
159.                        make a method which any number and any type of argument and print sum of that arguments.....
160.                        Can we override the main method?
161.                        we cannot create an object of interface but we can create a variable of it
162.                        can we overload main method?
163.                        how to execute main()
164.                        how to make hashmap object as synchronized object?
165.                        What is meant by Session? Explain something about HTTP Session Class?
166.                        What is meant by Servelet? What are the parameters of service method?
167.                        What is meant by Static query and Dynamic query?
168.                        What is the main functionality of Prepared Statement?
169.                        What is the exact difference in between Unicast and Multicast object?
170.                        explain the concept of virtual method invocation in polymorphism in detail?
171.                        explain about method overloading and method overriding with difficult examples
172.                        briefley expalin about the packages
173.                        What is mean by UML? what is the use? where we are using?
174.                        difference throws and throw in java
175.                        What is the blank final variable?
176.                        what is mena by object block any what is the use of that
177.                        What is the use of static keyword in "public static void main()"
178.                        how an we achive multiple inhetitance in java using interface..?
179.                        why should we get the following error ? Exception in main method NoClassDefFoundError:classname could anyone give the detail clarification on how java compiler can look for .class file?
180.                        Definition for connection pooling?
181.                        Difference between hashCode() & equals()?
182.                        How to Create A Wapper Class in core Java and Why are Use in java?
183.                        wat is final...? wat is finally...? wat is finalize....? difference between " final and finally and finalize "...?
184.                        what is Abstract DataType?
185.                        what is the difference between String and StringBuffer classes?
186.                        What is dynamic dispatch in java?
187.                        How many types of thread in java? give the name
188.                        how to identify duplicate values in arraylist
189.                        what is purpose of collections.unmodified() method..?
190.                        Why transient variables wont participate in serialization?
191.                        Can any one say how will sort map objects in java?
192.                        What are Interceptors?
193.                        Nested classes VS Inner classes?
194.                        how copy the hashmap object into arraylist at java program?
195.                        when everything can be done by static block then why do we use main method?.
196.                        what is difference betwenn Access Specifier and Access Modifier ?
197.                        is set interface synchronized by default?
198.                        Is it possible to do method overloading and overriding at a time
199.                        WHAT IS MARKER INTERFACE,AND NO METHODS IS NOT THERE ON THAT INTERFACE THEN WHY WE USED IN JAVA?
200.                        An inner class can actually be a subclass of the outer class? a. true b. false
201.                        what is the use of StringBuffer?
202.                        why java does not contain pointers?
203.                        what is the use of clone() in real time scenario?
204.                        What is the purpose of a statement block?
205.                        What is the difference between Java Bean and Java Class.?
206.                        How many types of syncronization?
207.                        what is object type casting? give some example with related?
208.                        Difference between Encapsulation and Abstraction
209.                        What is the use of static import ?
210.                        what r callable statement and give their proper use
211.                        use of wrapper classes?
212.                        What is immutable class? how to make a Class explicitly "Immutable"?Wap to make a class explicitly immutable.
213.                        How to implement Singleton
214.                        explain the collection in java
215.                        I dont want to use serialzable in java is there any another concept so plz tell me
216.                        Can I have constructor in Interface?
217.                        What is type casting?
218.                        There can be a abstract class without abstract methods, but what is the need to declare a class abstract if it doesn't contain abstract methods?
219.                        How many objects are created when we create String class object using new operator?
220.                        What is thread priority?

221.                        different between exception and error? explaim check and uncheck exception

No comments:

Post a Comment