Sunday, 12 February 2012

Core Java Interview Questions and Answers free download

0. Java Introduction?
1. What is the most important feature of Java?
2. What do you mean by platform independence?
3. Are JVM's platform independent?
4. What is a JVM?
5. What is the difference between a JDK and a JVM?
6. What is a pointer and does Java support pointers?
7. What is the base class of all classes?
8. Does Java support multiple inheritance?
9. Is Java a pure object oriented language?
10. Are arrays primitive data types?
11. What is difference between Path and Classpath?
12. What are local variables?
13. What are instance variables?
14. How to define a constant variable in Java?
15. Should a main method be compulsorily declared in all java classes?
16. What is the return type of the main method?
17. Why is the main method declared static?
18. What is the arguement of main method?
19. Can a main method be overloaded?
20. Can a main method be declared final?
21. Does the order of public and static declaration matter in main method?
22. Can a source file contain more than one Class declaration?
23. What is a package?
24. Which package is imported by default?
25. Can a class declared as private be accessed outside it's package?
26. Can a class be declared as protected?
27. What is the access scope of a protected method?
28. What is the purpose of declaring a variable as final?
29. What is the impact of declaring a method as final?
30. I don't want my class to be inherited by any other class. What should i do?
31. Can you give few examples of final classes defined in Java API?
32. How is final different from finally and finalize?
33. Can a class be declared as static?
34. When will you define a method as static?
35. What are the restriction imposed on a static method or a static block of code?
36. I want to print "Hello" even before main is executed. How will you acheive that?
37. What is the importance of static variable?
38. Can we declare a static variable inside a method?
39. What is an Abstract Class and what is it's purpose?
40. Can a abstract class be declared final?
41. What is use of a abstract variable?
42. Can you create an object of an abstract class?
43. Can a abstract class be defined without any abstract methods?
44. Class C implements Interface I containing method m1 and m2 declarations. Class C has
provided implementation for method m2. Can i create an object of Class C?
45. Can a method inside a Interface be declared as final?
46. Can an Interface implement another Interface?
47. Can an Interface extend another Interface?
48. Can a Class extend more than one Class?
49. Why is an Interface be able to extend more than one Interface but a Class can't extend more than one Class?
50. Can an Interface be final?
51. Can a class be defined inside an Interface?
52. Can an Interface be defined inside a class?
53. What is a Marker Interface?
54. Which OO Concept is achieved by using overloading and overriding?
55. If i only change the return type, does the method become overloaded?
56. Why does Java not support operator overloading?
57. What is the difference between the >> and >>> operators?
58. What is Externalizable?
59. What modifiers are allowed for methods in an Interface?
60. What is a local, member and a class variable?
61. What is an abstract method?
62. What value does read() return when it has reached the end of a file?
63. Can a Byte object be cast to a double value?
64. What is the difference between a static and a non-static inner class?
65. What is an object's lock and which object's have locks?
66. What is the % operator?
67. When can an object reference be cast to an interface reference?
68. Which class is extended by all other classes?
69. Which non-Unicode letter characters may be used as the first character of an identifier?
70. What restrictions are placed on method overloading?
71. What is casting?
72. What is a transient variable?
73. If a variable is declared as private, where may the variable be accessed?
74. What do you understand by private, protected and public?
75. What is Downcasting ?
76. What modifiers may be used with an inner class that is a member of an outer class?
77. How many bits are used to represent Unicode, ASCII, UTF-16, and UTF-8 characters?
78. What restrictions are placed on the location of a package statement within a source code file?
79. What is a native method?
80. What are order of precedence and associativity, and how are they used?
81. Can an anonymous class be declared as implementing an interface and extending a class?
82. What is the range of the char type?
83. What is the range of the short type?
84. Why isn't there operator overloading?
85. What does it mean that a method or field is "static"?
86. Is null a keyword?
87. Which characters may be used as the second character of an identifier,but not as the first character of an identifier?
88. Is the ternary operator written x : y ? z or x ? y : z ?
89. How is rounding performed under integer division?
90. If a class is declared without any access modifiers, where may the class be accessed?
91. Does a class inherit the constructors of its superclass?
92. What restrictions are placed on the values of each case of a switch statement?
93. What is the difference between a while statement and a do statement?
94. What modifiers can be used with a local inner class?
95. When does the compiler supply a default constructor for a class?
96. If a method is declared as protected, where may the method be accessed?
97. What are the legal operands of the instanceof operator?
98. What does it mean that a class or member is final?
99. How are this() and super() used with constructors?
100. What is the diffrence between inner class and nested class?
101.  What is the difference between a field variable and a local variable?
102. What is numeric promotion?
103. What is the difference between a public and a non-public class?
104. What is the difference between the prefix and postfix forms of the ++ operator?
105. What restrictions are placed on method overriding?
106. What is a Java package and how is it used?
107. What modifiers may be used with a top-level class?
108. What is the difference between an if statement and a switch statement?
109. What are the practical benefits, if any, of importing a specific class rather than an entire package (e.g. import java.net.* versus import java.net.Socket)?
110. Can a method be overloaded based on different return type but same argument type?
111.  What is the difference between a break statement and a continue statement?
112. How many static init can you have ?
113. What is the difference between method overriding and overloading?
114. What is constructor chaining and how is it achieved in Java ?
115. What is the difference between the Boolean & operator and the && operator?
116. Which Java operator is right associative?