51 frequently asked Java interview questions for freshers (0-2 Years Experience)

Java interview questions are widely spread over internet. Here I have compiled based on my experience with candidates and reading various pages over internet. Please refer for answers: 51 frequently asked Java interview questions and answers for freshers
  1. Why Java termed as platform independent language? Or What makes Java platform independent?
  2. JDK is platform dependent or platform independent? 
  3. Can you write a simple Java program and run it from command line ? Or What does 'public static void main ( String args[ ] ) ' stands for?
  4. What is PATH and CLASSPATH in Java ?
  5. What is encapsulation and  how does make it Java an object oriented language ?
  6. What is difference between Interface and Abstract class ?
  7. Write a simple program to demonstrate where Interface and Abstract class finds it's uses ?
  8. What is polymorphism in Java ? Can you explain with it's implementation in Java ?
  9. Write a simple program to take input form user and find number is even or odd ?
  10. In c++ we have constructor/destructor for creating/destroying objects, how it is handled in Java / Object life cycle in Java? 
  11. Have you used transient and volatile variable in Java? What is difference between them ?
  12. What is this and super in Java ?
  13. What do you mean by String is immutable ? or A question referring a String and
  14. Where do we use  == and equals() ? or Why equals() is good to use for Objects comparison ?
  15. What is wrapper class in Java? Explain with an example.How to we convert an string into integer in Java?
  16. Have you used Java 5 for loop ? Can you write a sample how do we iterate an array of String Object using it ?
  17. What is difference between overloading and overriding ? Can you explain with an example?
  18. What is static keyword /static block in Java?
  19. What is difference between instance method and class method in Java?
  20. What do you mean by inner class in Java? What are different kind of inner classes in Java ?
  21. How many .class file generated, when you create a class inside another class and compile it using javac ?
  22. What is thread ?Can you explain thread life cycle? Does Java support threading, if yes, then how?
  23. What are different ways you can create thread in Java? What are pros/cons of one over another ?
  24. What happens when we call run() method directly instead of calling start() method on a thread ?
  25. What do you understand from synchronization method or block in Java ? 
  26. What is Inheritance in Java? Explain with an example. Does Java support multiple inheritance ?
  27. Where do we use "protected" access modifier in Java ?/What are different access modifiers being used in Java ?
  28. What do you mean by dynamic binding in Java? Explain with an example.
  29. What is static binding in Java ?/ What is compile time binding ?
  30. What is basic criteria of distinguishing overloaded methods ?
  31. What is difference between String and StringBuffer, StringBuilder ?
  32. What is difference between these two declaration: String st1 = "abc"; String st2 = new String("abc");
  33. What is "final" keyword in Java? How does it affect variable, method or class behaviour?
  34. What is difference between IS-A and HAS-A in Java? Explain with an example. 
  35. What is exception handing in Java? Explain with try, catch and finally keyword in java ?
  36. What is difference between final and finally in Java ?
  37. What is difference between ClassNotFoundException and NoClassDefFoundError ?
  38. What data structure have you used for holding Objects in Java ?
  39. What is difference between ArrayList and LinkedList ? 
  40. Have you used HashMap? Write a sample code to create a hashMap and iteration over it ?
  41. Which of the two methods plays significant role in HashMap working ? / How equals() ad hashCode() play important role in hashMap working ?
  42. How do you convert an list into array in Java ? 
  43. What are collections algorithm in java? Give few examples.
  44. How hashMap is different from hashSet ?/Difference between HashMap and Hashtable ?
  45. What do you mean by type safety in Java and how does generics helps to achieve it ?
  46. Annotations in Java ?
  47. What is difference between throw and throws keyword in Java and where do we use them ?
  48. Can we have two main methods in Java ? Justify your reasoning.
  49. What is class Loader in Java ? Can you name some class loader used in Java.
  50. Difference between comparator and comparable? Explain with example. 
  51. How do you rate your self in Java?
Please refer for answers: 51 frequently asked Java interview questions and answers for freshers


Previous Post Next Post