GPH Theory: Your Ultimate Guide to General Topics, News, SEO, and Technology

Welcome to GPH Theory, your go-to source for the latest news, insights, and analysis on general topics, SEO, technology, and more. Our mission is to provide you with the most relevant and up-to-date information to help you stay ahead of the curve. From beginners to experts, we have something for everyone. Join us and start your journey towards digital excellence today.

Frequently asked core java interview questions

  Bittu      

INTERVIEW QUESTIONS

1. What is a transient variable?

2. Which containers use a border Layout as their default layout?

3. Why do threads block on I/O?

4. How are Observer and Observable used?

5. What is synchronization and why is it important?

6. Can a lock be acquired on a class?

7. What's new with the stop(), suspend() and resume() methods in JDK 1.2?

8. Is null a keyword?

9. What is the preferred size of a component?

10. What method is used to specify a container's layout?

11. Which containers use a FlowLayout as their default layout?

12. What state does a thread enter when it terminates its processing?

13. What is the Collections API?

14. Which characters may be used as the second character of an identifier, but not as the first

character of an identifier?

15. What is the List interface?

16. How does Java handle integer overflows and underflows?

17. What is the Vector class?

18. What modifiers may be used with an inner class that is a member of an outer class?

19. What is an Iterator interface?

20. What is the difference between the >> and >>> operators?

21. Which method of the Component class is used to set the position and size of a component?

22. How many bits are used to represent Unicode, ASCII, UTF-16, and UTF-8 characters?

23What is the difference between yielding and sleeping?

24. Which java.util classes and interfaces support event handling?

25. Is sizeof a keyword?

26. What are wrapped classes?

27. Does garbage collection guarantee that a program will not run out of memory?

28. What restrictions are placed on the location of a package statement within a source code file?

29. Can an object's finalize() method be invoked while it is reachable?

30. What is the immediate superclass of the Applet class?

31. What is the difference between preemptive scheduling and time slicing?

32. Name three Component subclasses that support painting.

33. What value does readLine() return when it has reached the end of a file?

34. What is the immediate superclass of the Dialog class?

35. What is clipping?

36. What is a native method?

37. Can a for statement loop indefinitely?

38. What are order of precedence and associativity, and how are they used?

39. When a thread blocks on I/O, what state does it enter?

40. To what value is a variable of the String type automatically initialized?

41. What is the catch or declare rule for method declarations?

42. What is the difference between a MenuItem and a CheckboxMenuItem?

43. What is a task's priority and how is it used in scheduling?

44. What class is the top of the AWT event hierarchy?

45. When a thread is created and started, what is its initial state?

46. Can an anonymous class be declared as implementing an interface and extending a class?

47. What is the range of the short type?

48. What is the range of the char type?

49. In which package are most of the AWT events that support the event-delegation model defined?

50. What is the immediate superclass of Menu?

51. What is the purpose of finalization?

52. Which class is the immediate superclass of the MenuComponent class.

53. What invokes a thread's run() method?

54. What is the difference between the Boolean & operator and the && operator?

55. Name three subclasses of the Component class.

56. What is the GregorianCalendar class?

57. Which Container method is used to cause a container to be laid out and redisplayed?

58. What is the purpose of the Runtime class?

59. How many times may an object's finalize() method be invoked by the garbage collector?

60. What is the purpose of the finally clause of a try-catch-finally statement?

61. What is the argument type of a program's main() method?

62. Which Java operator is right associative?

63. What is the Locale class?

64. Can a double value be cast to a byte?

65. What is the difference between a break statement and a continue statement?

66. What must a class do to implement an interface?

67. What method is invoked to cause an object to begin executing as a separate thread?

68. Name two subclasses of the TextComponent class.

69. What is the advantage of the event-delegation model over the earlier event-inheritance model?

70. Which containers may have a MenuBar?

71. How are commas used in the initialization and iteration parts of a for statement?

72. What is the purpose of the wait(), notify(), and notifyAll() methods?

73. What is an abstract method?

74. How are Java source code files named?

75. What is the relationship between the Canvas class and the Graphics class?

76. What are the high-level thread states?

77. What value does read() return when it has reached the end of a file?

78. Can a Byte object be cast to a double value?

79. What is the difference between a static and a non-static inner class?

80. What is the difference between the String and StringBuffer classes?

81. If a variable is declared as private, where may the variable be accessed?

82. What is an object's lock and which object's have locks?

83. What is the Dictionary class?

84. How are the elements of a BorderLayout organized?

85. What is the % operator?

86. When can an object reference be cast to an interface reference?

87. What is the difference between a Window and a Frame?

88. Which class is extended by all other classes?

89. Can an object be garbage collected while it is still reachable?

90. Is the ternary operator written x : y ? z or x ? y : z ?

91. What is the difference between the Font and FontMetrics classes?

92. How is rounding performed under integer division?

93. What happens when a thread cannot acquire a lock on an object?

94. What is the difference between the Reader/Writer class hierarchy and the InputStream/

OutputStream class hierarchy?

95. What classes of exceptions may be caught by a catch clause?

96. If a class is declared without any access modifiers, where may the class be accessed?

97. What is the SimpleTimeZone class?

98. What is the Map interface?

99. Does a class inherit the constructors of its superclass?

100. For which statements does it make sense to use a label?

101. What is the purpose of the System class?

102. Which TextComponent method is used to set a TextComponent to the read-only state?

103. How are the elements of a CardLayout organized?

104. Is &&= a valid Java operator?

105. Name the eight primitive Java types.

106. Which class should you use to obtain design information about an object?

107. What is the relationship between clipping and repainting?

108. Is "abc" a primitive value?

109. What is the relationship between an event-listener interface and an event-adapter class?

110. What restrictions are placed on the values of each case of a switch statement?

111. What modifiers may be used with an interface declaration?

112. Is a class a subclass of itself?

113. What is the highest-level event class of the event-delegation model?

114. What event results from the clicking of a button?

115. How can a GUI component handle its own events?

116. What is the difference between a while statement and a do statement?

117. How are the elements of a GridBagLayout organized?

118. What advantage do Java's layout managers provide over traditional windowing systems?

119. What is the Collection interface?

120. What modifiers can be used with a local inner class?

121. What is the difference between static and non-static variables?

122. What is the difference between the paint() and repaint() methods?

123. What is the purpose of the File class?

124. Can an exception be rethrown?

125. Which Math method is used to calculate the absolute value of a number?

126. How does multithreading take place on a computer with a single CPU?

127. When does the compiler supply a default constructor for a class?

128. When is the finally clause of a try-catch-finally statement executed?

129. Which class is the immediate superclass of the Container class?

130. If a method is declared as protected, where may the method be accessed?

131. How can the Checkbox class be used to create a radio button?

132. Which non-Unicode letter characters may be used as the first character of an identifier?

133. What restrictions are placed on method overloading?

134. What happens when you invoke a thread's interrupt method while it is sleeping or waiting?

135. What is casting?

 

136. What is the return type of a program's main() method?

137. Name four Container classes.

138. What is the difference between a Choice and a List?

139. What class of exceptions are generated by the Java run-time system?

140. What class allows you to read objects directly from a stream?

141. What is the difference between a field variable and a local variable?

142. Under what conditions is an object's finalize() method invoked by the garbage collector?

143. How are this() and super() used with constructors?

144. What is the relationship between a method's throws clause and the exceptions that can be thrown during the method's execution?

145. What is the difference between the JDK 1.02 event model and the event-delegation model introduced with JDK 1.1?

146. How is it possible for two String objects with identical values not to be equal under the == operator?

147. Why are the methods of the Math class static?

148. What Checkbox method allows you to tell if a Checkbox is checked?

149. What state is a thread in when it is executing?

150. What are the legal operands of the instanceof operator?

151. How are the elements of a GridLayout organized?

152. What an I/O filter?

153. If an object is garbage collected, can it become reachable again?

154. What is the Set interface?

155. What classes of exceptions may be thrown by a throw statement?

156. What are E and PI?

157. Are true and false keywords?

158. What is a void return type?

159. What is the purpose of the enableEvents() method?

160. What is the difference between the File and RandomAccessFile classes?

161. What happens when you add a double value to a String?

162. What is your platform's default character encoding?

163. Which package is always imported by default?

164. What interface must an object implement before it can be written to a stream as an object?

165. How are this and super used?

166. What is the purpose of garbage collection?

167. What is a compilation unit?

168. What interface is extended by AWT event listeners?

169. What restrictions are placed on method overriding?

170. How can a dead thread be restarted?

171. What happens if an exception is not caught?

172. What is a layout manager?

173. Which arithmetic operations can result in the throwing of an ArithmeticException?

174. What are three ways in which a thread can enter the waiting state?

175. Can an abstract class be final?

176. What is the ResourceBundle class?

 

177. What happens if a try-catch-finally statement does not have a catch clause to handle an

exception that is thrown within the body of the try statement?

178. What is numeric promotion?

179. What is the difference between a Scrollbar and a ScrollPane?

180. What is the difference between a public and a non-public class?

181. To what value is a variable of the boolean type automatically initialized?

182. Can try statements be nested?

183. What is the difference between the prefix and postfix forms of the ++ operator?

184. What is the purpose of a statement block?

185. What is a Java package and how is it used?

186. What modifiers may be used with a top-level class?

187. What are the Object and Class classes used for?

188. How does a try statement determine which catch clause should be used to handle an exception?

189. Can an unreachable object become reachable again?

190. When is an object subject to garbage collection?

191. What method must be implemented by all threads?

192. What methods are used to get and set the text label displayed by a Button object?

193. Which Component subclass is used for drawing and painting?

194. What are synchronized methods and synchronized statements?

195. What are the two basic ways in which classes that can be run as threads may be defined?

196. What are the problems faced by Java programmers who don't use layout managers?

197. What is the difference between an if statement and a switch statement?

198. What is the List interface?

logoblog

Thanks for reading Frequently asked core java interview questions

Previous
« Prev Post

No comments:

Post a Comment