Java - Interviews Questions

Basics of Java Interview Questions
  1. What do you know about Java?
    Java is a high-level programming language originally developed by Sun Microsystems and released in 1995. Java runs on a variety of platforms, such as Windows, Mac OS, and the various versions of UNIX.
  2. What are the supported platforms by Java Programming Language?
    Java runs on a variety of platforms, such as Windows, Mac OS, and the various versions of UNIX/Linux like HP-Unix, Sun Solaris, Redhat Linux, Ubuntu, CentOS, etc.
  3. List any five features of Java?
    Some features include Object Oriented, Platform Independent, Robust, Interpreted, Multi-threaded.
  4. Why is Java Architectural Neutral?
    It's compiler generates an architecture-neutral object file format, which makes the compiled code to be executable on many processors, with the presence of Java runtime system.
  5. How Java enabled High Performance?
    Java uses Just-In-Time compiler to enable high performance. Just-In-Time compiler is a program that turns Java bytecode, which is a program that contains instructions that must be interpreted into instructions that can be sent directly to the processor.
  6. List two Java IDE's?
    Netbeans, Eclipse, etc.
  7. What is difference between JDK,JRE and JVM?
  8. How many types of memory areas are allocated by JVM?
  9. What is JIT compiler?
  10. What is platform?
  11. What is the main difference between Java platform and other platforms?
  12. What gives Java its 'write once and run anywhere' nature?
  13. What is classloader?
  14. Can we execute a program without main() method?
  15. What is difference between static (class) method and instance method?
  16. Why Java does not support pointers?
  17. What is Garbage Collection?
  18. What is gc()?
  19. What is the purpose of finalize() method?
OOPs Interview Questions
  1. What is difference between object oriented programming language and object based programming language?
  2. What is constructor?
  3. What is the purpose of default constructor?
  4. Does constructor return any value?
  5. What is static variable?
  6. What is static method?
  7. Why main method is static?
  8. What is static block?
  9. What is this in java?
  10. What is Inheritance?
  11. Which class is the superclass for every class?
  12. Why multiple inheritance is not supported in java?
  13. What is super in java?
  14. What do you mean by Object?
  15. Define class?
  16. What kind of variables a class can consist of?
    A class consist of Local variable, instance variables and class variables.
  17. What is a Local Variable?
    Variables defined inside methods, constructors or blocks are called local variables. The variable will be declared and initialized within the method and it will be destroyed when the method has completed.
  18. What is a Instance Variable?
    Instance variables are variables within a class but outside any method. These variables are instantiated when the class is loaded.
  19. What is a Class Variable?
    These are variables declared with in a class, outside any method, with the static keyword.
  20. What do you mean by Constructor?
    Constructor gets invoked when a new object is created. Every class has a constructor. If we do not explicitly write a constructor for a class the java compiler builds a default constructor for that class.
  21. When a byte datatype is used?
    This data type is used to save space in large arrays, mainly in place of integers, since a byte is four times smaller than an int.
  22. What is a static variable?
    Class variables also known as static variables are declared with the static keyword in a class, but outside a method, constructor or a block.
  23. What do you mean by Access Modifier?
  24. Can you use this() and super() both in a constructor?
  25. What is object cloning?
  26. What is method overloading?
  27. Why method overloading is not possible by changing the return type in java?
  28. Can we overload main() method?
  29. What is method overriding?
  30. Can we override static method?
  31. Why we cannot override static method?
  32. According to Java Operator precedence, which operator is considered to be with highest precedence?
    Postfix operators i.e () [] . is at the highest precedence.
  33. Why is String class considered immutable?
  34. Why is StringBuffer called mutable?
  35. What is the difference between StringBuffer and StringBuilder class?
  36. What is an Exception?
  37. Explain Runtime Exceptions?
  38. When throws keyword is used?
  39. Define Inheritance?
  40. When super keyword is used?
  41. What is Polymorphism?
  42. What is Abstraction?
  43. What is Abstract class?
  44. When Abstract methods are used?
  45. What is Encapsulation?
  46. What is an Interface?
  47. Define Packages in Java?
  48. What do you mean by Multithreaded program?
  49. Explain garbage collection in Java?
  50. Define immutable object?
  51. Explain the usage of this() with constructors?
  52. Difference between throw and throws?
  53. Define JRE i.e. Java Runtime Environment?
  54. What is JAR file?
  55. Define JIT compiler?
  56. What is the purpose of default constructor?
  57. What is static block?
  58. What is function overloading?
  59. What is function overriding?
  60. Can we override the overloaded method?
  61. Difference between method Overloading and Overriding?
  62. Can you have virtual functions in Java?
  63. Is it possible to instantiate the abstract class?
  64. What is interface?
  65. Can you declare an interface method static?
  66. Can an Interface be final?
  67. What is difference between final, finally and finalize?
  68. What is difference between abstract class and interface?
  69. Can we define private and protected modifiers for variables in interfaces?
  70. When can an object reference be cast to an interface reference?
  71. What is package?
  72. What is Exception Handling?
  73. What is difference between Checked Exception and Unchecked Exception?
  74. What is the base class for Error and Exception?
  75. Is it necessary that each try block must be followed by a catch block?
  76. What is finally block?
  77. Can finally block be used without catch?
  78. Is there any case when finally will not be executed?
  79. What is difference between throw and throws?
  80. What is final variable?
  81. What is final method?
  82. What is final class?
  83. What is the meaning of immutable in terms of String?
  84. Why string objects are immutable in java?
  85. How many ways we can create the string object?
  86. What is the basic difference between string and stringbuffer object?
  87. What is the difference between StringBuffer and StringBuilder ?
  88. How can we create immutable class in java ?
  89. What is the purpose of toString() method in java ?
  90. What is nested class?
  91. Is there any difference between nested classes and inner classes?
  92. Can we access the non-final local variable, inside the local inner class?
  93. What is nested interface ?
  94. Can a class have an interface?
  95. Can an Interface have a class?
  96. What is blank final variable?
  97. Can we intialize blank final variable?
  98. Can you declare the main method as final?
  99. What is Runtime Polymorphism?
  100. What is the difference between static binding and dynamic binding?
  101. What is abstraction?
  102. What is the difference between abstraction and encapsulation?
  103. What is abstract class?
  104. Can there be any abstract method without abstract class?
  105. Can you use abstract and final both with a method?
  106. What is final class?
  107. What is NullPointerException?
  108. What invokes a thread's run() method?
  109. What are Wrapper classes?
  110. What is the difference between static and non-static variables?
  111. What is Serialization and deserialization?
  112. What is a transient variable?
  113. What is synchronization?
  114. What is the difference between a break statement and a continue statement?
  115. What is the difference between an Interface and an Abstract class?
  116. Why do we need wrapper classes?
  117. What is the difference between error and an exception?
  118. What is dot operator?
  119. What is type casting?
  120. Describe life cycle of thread?
  121. What is a Socket?
  122. What is an enumeration?
  123. What is the difference between inner class and nested class?
  124. What is serialization?
  125. What is Deserialization?
  126. What is transient keyword?
  127. What is Externalizable?
  128. What is the difference between Serializalble and Externalizable interface?
  129. What are wrapper classes?
  130. What is multithreading?
  131. What is thread?
  132. What does join() method?
  133. What is difference between wait() and sleep() method?
  134. Can we call the run() method instead of start()?
  135. What is synchronization?
  136. What is the purpose of Synchronized block?
  137. What is static synchronization?
  138. What is deadlock?
  139. What is the difference between ArrayList and Vector?
  140. What is the difference between ArrayList and LinkedList?
  141. What is the difference between Iterator and ListIterator?
  142. What is the difference between Iterator and Enumeration?
  143. What is the difference between List and Set?
  144. What is the difference between HashSet and TreeSet?
  145. What is the difference between Set and Map?
  146. What is the difference between HashSet and HashMap?
  147. What is the difference between HashMap and TreeMap?
  148. What is the difference between HashMap and Hashtable?
  149. What is the difference between Collection and Collections?
  150. What is the difference between Comparable and Comparator?
  151. What is the advantage of generic collection?
  152. What is the Dictionary class?

BytecodeTechnosolutions.com | Raju