Vous êtes sur la page 1sur 2

Java - FAQ

Q1)What is the difference between yielding and sleeping?


Q2) What are wrapped classes?
Q3) what is a transient variable?
Q4) Why is java not 100% pure oops?
Q5) What is the difference between an Abstract class and Interface?
Q6) What do you know about the garbage collector?
Q7) What is the difference between java and c++?
Q8) When will you use an interface and abstract class?
Q9) Does java support multiple inheritance? if not, what is the solution?
Q10) What is the difference between a JDK and a JVM?
Q11) What is serialVersionUID and what is its need?
Q12) Why do we need main method to execute a java program?
Q13) What design pattern you have used in your project? I answered Factory pattern, how it is
implemented? What are its advantage? Do know about Abstract Factory?
Q14) What collections you have worked on? Internal working of Hashmap?
Q15) Why does java not allow multiple public classes in a java file ?
Q16) What is difference between Runnable and Thread in Java ?
Q17) What happens if you don't call wait and notify from synchronized block?
Q18) Difference between
a) Vector and Arraylist b) LinkedList and ArrayList c) throw and throws d) HashSet and
HashMap e) checked and unchecked exception
Q19) Why String is immutable in Java?
Q20) Why Java does not support operator overloading ?
Q21) Can you override static method in Java? if I create same method in subclass is it compile
time error?

Q22) Why multiple inheritance is not supported in Java ?


Q23) Explain Autoboxing,Enumerations,Generics and Varargs methods in Java
Q24) What does the the expression 1.0 / 0.0 will return? will it throw Exception?
any compile time error?
Q25) What will happen if you put return statement or System.exit () on try or catch block ? Will
finally block execute?
Q26) If a method throws NullPointerException in super class, can we override it with a method
which throws RuntimeException?
Q27) How do you ensure that N thread can access N resources without deadlock
Q28) is it possible to load a class by two ClassLoader?
Q29) Why compareTo() should be consistent to equals() method in Java?
Q30) Difference between notify() and notifyAll() call
Q31) Why we call Thread.start() method which in turn call run()? Or
What if we call run() method directly?

Q32) Does java support function overloading, pointers, structures, unions or linked lists?
Q33) What is synchronization and why is it important?
Q34) Why do we need Finally with try? pls expain with ur example.
Q35) How to prevent to create multiple objects of a java class?
Q36) Difference between error and exception
Q37) 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???"; } }
Q38) System.out & System.in are final static data member of System class but we can change
there reference through setOut() & setIn() method how..
Q39) can we overload main method?If yes how we can do it.
Q40) difference between HashMap, Hashset and hashTable?
Q41) What is the difference between Super and This Keyword?

Vous aimerez peut-être aussi