Java Interview Questions

CORE JAVA
1.Can a main() method of class be invoked in another class?

2. What is the difference between == & .equals
3. What is the difference between abstract class & Interface.

4. What is singleton class & it's implementation.

5. Use of static,final variable

6. Examples of final class

7. Difference between Event propagation & Event delegation

8. Difference between Unicast & Multicast model

9. What is a java bean

10. What is synchronized keyword used for.

12. What are the restrictions of an applet & how to make the applet access the local

machines resources.

14. What is reflect package used for & the methods of it.

16. What is serialization used for

1.Can methods be overloaded based on the return types ?

2.Why do we need a finalze() method when Garbage Collection is there ?

52. Difference between AWT and Swing compenents ?

53. Is there any heavy weight component in Swings ?

54. Can the Swing application if you upload in net, be compatible with your browser?

55. What should you do get your browser compatible with swing components?

57. What are the methods in Applet ?

58. When is init(),start() called ?

59. When you navigate from one applet to another what are the methods called?

60. What is the difference between Trusted and Untrusted Applet ?

61. What is Exception ?

62. What are the ways you can handle exception ?

63. When is try,catch block used ?

64. What is finally method in Exceptions ?

65. What are the types of access modifiers ?

66. What is protected and friendly ?

67. What are the other modifiers ?

68. Is synchronised modifier ?

69. What is meant by polymorphism ?

70. What is inheritance ?

71. What is method Overloading ? What is this in OOPS ?

72. What is method Overriding ? What is it in OOPS ?

73. Does java support multi dimensional arrays ?

74. Is multiple inheritance used in Java ?

75. How do you send a message to the browser in JavaScript ?

Java Interview Questions


2


76. Does javascript support multidimensional arrays ?

80. Is there any tool in java that can create reports ?

81. What is meant by Java ?

82. What is meant by a class ?

83. What is meant by a method ?

84. What are the OOPS concepts in Java ?

85. What is meant by encapsulation ? Explain with an example

86. What is meant by inheritance ? Explain with an example

87. What is meant by polymorphism ? Explain with an example

88. Is multiple inheritance allowed in Java ? Why ?

89. What is meant by Java interpreter ?

90. What is meant by JVM ?

91. What is a compilation unit ?

92. What is meant by identifiers ?

93. What are the different types of modifiers ?

94. What are the access modifiers in Java ?

95. What are the primitive data types in Java ?

96. What is meant by a wrapper class ?

97. What is meant by static variable and static method ?

98. What is meant by Garbage collection ?

99. What is meant by abstract class

100. What is meant by final class, methods and variables ?

101. What is meant by interface ?

102. What is meant by a resource leak ?

103. What is the difference between interface and abstract class ?

104. What is the difference between public private, protected and static

106. What is meant by method overloading ?

107. What is meant by method overriding ?

108. What is singleton class ?

109. What is the difference between an array and a vector ?

110. What is meant by constructor ?

111. What is meant by casting ?

112. What is the difference between final, finally and finalize ?

113. What is meant by packages ?

114. What are all the packages ?

115. Name 2 calsses you have used ?

116. Name 2 classes that can store arbitrary number of objects ?

117. What is the difference between java.applet.* and java.applet.Applet ?

118. What is a default package ?

119. What is meant by a super class and how can you call a super class ?

Java Interview Questions


3


120. What is anonymous class ?

121. Name interfaces without a method ?

122. What is the use of an interface ?

123. What is a serializable interface ?

124. How to prevent field from serialization ?

125. What is meant by exception ?

126. How can you avoid the runtime exception ?

127. What is the difference between throw and throws ?

128. What is the use of finally ?

129. Can multiple catch statements be used in exceptions ?

130. Is it possible to write a try within a try statement ?

131. What is the method to find if the object exited or not ?

132. What is meant by a Thread ?

133. What is meant by multi-threading ?

134. What is the 2 way of creating a thread ? Which is the best way and why?

135. What is the method to find if a thread is active or not ?

136. What are the thread-to-thread communcation ?

137. What is the difference between sleep and suspend ?

138. Can thread become a member of another thread ?

139. What is meant by deadlock ?

140. How can you avoid a deadlock ?

141. What are the three typs of priority ?

142. What is the use of synchronizations ?

143. Garbage collector thread belongs to which priority ?

144. What is meant by time-slicing ?

145. What is the use of 'this' ?

146. How can you find the length and capacity of a string buffer ?

147. How to compare two strings ?

148. What are the interfaces defined by Java.lang ?

149. What is the purpose of run-time class and system class

150. What is meant by Stream and Types ?

151. What is the method used to clear the buffer ?

152. What is meant by Stream Tokenizer ?

153. What is serialization and de-serialisation ?

154. What is meant by Applet ?

155. How to find the host from which the Applet has originated ?

156. What is the life cycle of an Applet ?

157. How do you load an HTML page from an Applet ?

158. What is meant by Applet Stub Interface ?

159. What is meant by getCodeBase and getDocumentBase method ?

160. How can you call an applet from a HTML file

161. What is meant by Applet Flickering ?

162. What is the use of parameter tag ?

163. What is audio clip Interface and what are all the methods in it

Java Interview Questions


4


164. What is the difference between getAppletInfo and getParameterInfo ?

165. How to communicate between applet and an applet ?

166. What is meant by event handling ?

167. What are all the listeners in java and explain ?

168. What is meant by an adapter class ?

169. What are the types of mouse event listeners ?

170. What are the types of methods in mouse listeners ?

171. What is the difference between panel and frame ?

172. What is the default layout of the panel and frame ?

173. What is meant by controls and types ?

174. What is the difference between a scroll bar and a scroll panel.

175. What is the difference between list and choice ?

176. How to place a component on Windows ?

177. What are the different types of Layouts ?

178. What is meant by CardLayout ?

179. What is the difference between GridLayout and GridBagLayout

180. What is the difference between menuitem and checkboxmenu item.

181. What is meant by vector class, dictionary class , hash table,class,and property class ?

182. Which class has no duplicate elements ?

183. What is resource bundle ?

184. What is an enumeration class ?

185. What is meant by Swing ?

186. What is the difference between AWT and Swing ?

187. What is the difference between an applet and a Japplet

188. What are all the components used in Swing ?

189. What is meant by tab pans ?

190. What is the use of JTree ?

191. How can you add and remove nodes in Jtree.

192. What is the method to expand and collapse nodes in a Jtree

?

193. What is the use of JTable ?

194. What is meant by JFC ?

195. What is the class in Swing to change the appearance of the

Frame in Runtime.

196. How to reduce flicking in animation ?

263. What is meant by Javabeans ?

264. What is JAR file ?

265. What is meant by manifest files ?

266. What is Introspection ?

267. What are the steps involved to create a bean ?

268. Say any two properties in Beans ?

Java Interview Questions


5


269. What is persistence ?

270. What is the use of beaninfo ?

271. What are the interfaces you used in Beans ?

272. What are the classes you used in Beans ?

273. What is the diffrence between an Abstract class and Interface

?

274. What is user defined exception ?

275. What do you know about the garbate collector ?

276. What is the difference between C++ & Java ?

278. How do you communicate in between Applets & Servlets ?

279. What is the use of Servlets ?

281. In an HTML form I have a Button which makes us to open

another

282. page in 15 seconds. How will do you that ?

283. What is the difference between Process and Threads ?

286. How will you initialize an Applet ?

287. What is the order of method invocation in an Applet ?

288. When is update method called ?

291. How will you communicate between two Applets ?

290. Have you ever used HashTable and Dictionary ?

292. What are statements in JAVA ?

293. What is JAR file ?

294. What is JNI ?

295. What is the base class for all swing components ?

296. What is JFC ?

297. What is Difference between AWT and Swing ?

298. Considering notepad/IE or any other thing as process, What

will

299. Happen if you start notepad or IE 3 times? Where 3 processes

are started or 3 threads are started ?

300. How does thread synchronization occurs inside a monitor ?

301. How will you call an Applet using a Java Script function ?

302. Is there any tag in HTML to upload and download files ?

303. Why do you Canvas ?

304. How can you push data from an Applet to Servlet ?

322. What are the benefits of Swing over AWT ?

323. Where the CardLayout is used ?

324. What is the Layout for ToolBar ?

325. What is the difference between Grid and GridbagLayout ?

326. How will you add panel to a Frame ?

327. What is the corresponding Layout for Card in Swing ?

328. What is light weight component ?

332. What is bean ? Where it can be used ?

333. What is difference in between Java Class and Bean ?

341. What is the mapping mechanism used by Java to identify IDL

language ?

Java Interview Questions


6


342. Diff between Application and Applet ?

343. What is serializable Interface ?

344. What is the difference between CGI and Servlet ?

345. What is the use of Interface ?

346. Why Java is not fully objective oriented ?

347. Why does not support multiple Inheritance ?

348. What it the root class for all Java classes ?

349. What is polymorphism ?

350. Suppose If we have variable ' I ' in run method, If I can

create one or

351. More thread each thread will occupy a separate copy or same

variable will be shared ?

360. What is Constructor and Virtual function? Can we call

Virtual

361. Funciton in a constructor ?

362. Why we use OOPS concepts? What is its advantage ?

372. What is the difference in between C++ and Java ? can u

explain in

373. detail?

368. What is the exact difference in between Unicast and

Multicast

369. object ? Where we will use ?

390. How do you sing an Applet ?
391. In a Container there are 5 components. I want to display the
all

392. The components names, how will you do that one ?

393. Why there are some null interface in java ? What does it mean

?

394. Give me some null interfaces in JAVA ?

395. Tell me the latest versions in JAVA related areas ?

396. What is meant by class loader ? How many types are there?

When

397. will we use them ?

399. What is meant by flickering ?

410. What is meant by cookies ? Explain ?

411. Problem faced in your earlier project

412. How OOPS concept is achieved in Java

413. Features for using Java

414. How does Java 2.0 differ from Java 1.0

415. Public static void main - Explain

416. What are command line arguments

417. Explain about the three-tier model

418. Difference between String & StringBuffer

419. Wrapper class. Is String a Wrapper Class

420. What are the restriction for static method

421. Purpose of the file class

Java Interview Questions


7


422. Default modifier in Interface

423. Difference between Interface & Abstract class

424. Can abstract be declared as Final

425. Can we declare variables inside a method as Final Variables

426. What is the package concept and use of package

427. How can a dead thread be started

428. Difference between Applet & Application

429. Life cycle of the Applet

430. Can Applet have constructors

431. Differeence between canvas class & graphics class

432. Explain about Superclass & subclass

434. What is AppletStub

435. Explain Stream Tokenizer

436. What is the difference between two types of threads

437. Checked & Unchecked exception

438. Use of throws exception

439. What is finally in exception handling

440. Vector class

441. What will happen to the Exception object after exception

handling

442. Two types of multi-tasking

443. Two ways to create the thread

444. Synchronization

445. I/O Filter

447. Can applet in different page communicate with each other

364. Why Java is not 100 % pure OOPS ? ( EcomServer )

365. When we will use an Interface and Abstract class ?

336. How to communicate 2 threads each other ?

UML

1.What are all the diagrams available in UML and what is the purpose of each

diagram ?

EJB

1. What is Entity Bean and Session Bean ?

2. What are the methods of Entity Bean?

3. How does Stateful Session bean store its state ?

4. Why does Stateless Session bean not store its state even

though

5. it has ejbActivate and ejbPassivate ?

6. What are the services provided by the container ?

7. Types of transaction ?

8. What is bean managed transaction ?

9. Why does EJB needs two interface( Home and Remote Interface)

Java Interview Questions


8


?

10. What are transaction attributes ?

11. What is the difference between Container managed persistent

bean and Bean managed persistent entity bean ?

12. What is J2EE ?

13. What is JTS ?

14. How many entity beans used and how many tables can u use in

EJB

15. project

16. What is scalable,portability in J2EE?

17. What is Connection pooling?Is it advantageous?

18. Method and class used for Connection pooling ?

19. How to deploy in J2EE(i.e Jar,War file) ?

20. How is entity bean created using Container managed entity bean

?

21. Sotware architechture of EJB ?

22. In Entity bean will the create method in EJB home and

ejbCreate

23. In Entity bean have the same parameters ?

DATABASE

19. Functions in Oracle/SQL Server.

42. What are the types of JDBC drivers ?

43. Explain the third driver(Native protocol driver) ?

44. Which among the four driver is pure Java driver ?

45. What are the Isolation level in JDBC transaction ?

46. How do you connect with the database ?

47. How do you connect without the Class.forName (" ") ?

48. What does Class.forName return ?

49. What are the types of statement ?

50. Why is preparedStatement,CallableStatement used for?

51. In real time project which driver did u use ?

197. What is JDBC ?

198. How do you connect to the database ? What are the steps ?

199. What are the drivers available in JDBC ? Explain

200. How can you load the driver ?

201. What are the different types of statement s ?

202. How can you created JDBC statements ?

203. How will you perform transactions using JDBC ?

204. What are the two drivers for web apllication?

205. What are the different types of 2 tier and 3 tier

architecture ?

206. How can you retrieve warning in JDBC ?

207. What is the exception thrown by JDBC ?

208. What is meants by PreparedStatement ?

209. What is difference between PreparedStatement and Statement

Java Interview Questions


9


?

210. How can you call the stored procedures ?

211. What is meant by a ResultSet ?

212. What is the difference between ExecuteUpdate and ExecuteQuery

?

213. How do you know which driver is connected to a database ?

214. What is DSN and System DSN and differentiate these two ?

280. What is JDBC? How do you connect to the Database ?

305. What are 4 drivers available in JDBC ?

306. How you can know about drivers and database information ?

307. If you are truncated using JDBC, How can you know ..that how

much

308. Data is truncated ?

309. And What situation , each of the 4 drivers used ?

310. How will you perform transaction using JDBC ?

376. What is the main functionality of the Prepared Statement ?

377. What is meant by static query and dynamic query ?

378. What are the Normalization Rules ? Define the Normalization

?

446. How can you retrieve warnings in JDBC

448. Four driver Manager

449. Features of JDBC 20

450. Explain about stored procedures

403. What is the latest version of JDBC ? What are the new

features

404. Are added in that ?

XML & XSLT

2.Benefits of XML.

15. Use of xslt

77. Why is XML used mainly?

78. Do use coding for database connectivity in XML?

79. What is DTD ?

SERVLETS

5.How do u deal property files in servlet?

24. What methods do u use in Servlet - Applet communication ?

25. What are the types of Servlet ?

26. Difference between HttpServlet and Generic Servlets ?

27. Difference between doGet and doPost ?

28. What are the methods in HttpServlet?

29. What are the types of SessionTracking?

30. What is Cookie ? Why is Cookie used ?

31. If my browser does not support Cookie,and my server sends a

Java Interview Questions


10


cookie instance What will happen ?

32. Why do u use Session Tracking in HttpServlet ?

33. Can u use javaScript in Servlets ?

34. What is the capacity the doGet can send to the server ?

35. What are the type of protocols used in HttpServlet ?

224. What is meant by a servlet ?

225. What are the types of servlets ? Explain

226. What is the different between a Servlet and a CGI.

227. What is the difference between 2 types of Servlets ?

228. What is the type of method for sending request from HTTP

server ?

229. What are the exceptions thrown by Servlets ? Why ?

230. What is the life cycle of a servlet ?

231. What is meant by cookies ?

232. What is HTTP Session ?

233. What is the difference between GET and POST methods ?

234. How can you run a Servlet Program ?

235. How to commuincate between an applet and a servlet ?

236. What is a Servlet-to-Servlet communcation ?

237. What is Session Tracking ?

238. What are the security issues in Servlets ?

239. What is HTTP Tunneling

240. How do you load an image in a Servlet ?

241. What is Servlet Chaining ?

242. What is URL Rewriting ?

243. What is context switching ?

289. How will you pass values from HTML page to the Servlet ?

331. What is Servlet API used for conneting database ?

352. In servlets, we are having a web page that is invoking

servlets

353. Username and password ? which is cheks in the database ?

Suppose the second page also If we want to verify the same

information whethe it will connect to the database or it will be

used previous information?

354. What are virtual functions ?

355. Write down how will you create a binary Tree ?

356. What are the traverses in Binary Tree ?

357. Write a program for recursive Traverse ?

358. What are session variable in Servlets ?

359. What is client server computing ?

379. What is meant by Servelet? What are the parameters of the

service

380. Method ?

381. What is meant by Session ? Tell me something about

HTTPSession

382. Class ?

Java Interview Questions


11


383. How do you invoke a Servelt? What is the difference in

between

384. DoPost and doGet methods ?

385. What is the difference in between the HTTPServlet and

Generic

386. Servlet?

387. Expalin their methods ? Tell me their parameter names also

?

388. Have you used threads in Servelet ?

398. How do you load an Image in a Servlet ?

451. Servlet Life cycle

452. Why do you go for servlet rather than CGI

JSP

4.Can the init method of servlet be overloaded in jsp?

12.About jsp tags.

SERVERS

3.Advantages of appln servers.

330. What is the webserver used for running the Servlets ?

406. What is the role of the webserver ?

TCP?IP?UDP

11. What is the difference between TCP/IP & UDP.

36. Difference between TCP/IP and IP protocol ?

215. What is meant by TCP, IP, UDP ?

216. What is the difference between TCP and UDP ?

217. What is a proxy server ?

218. What is meant by URL

219. What is a socket and server sockets ?

221. What is InetAddress ?

222. What is datagram and datagram packets and datagram sockets

?

223. Write the range of multicast socket IP address ?

433. Difference between TCP & UDP

RMI

37. Why do you use UniCastRemoteObject in RMI ?

38. How many interfaces are used in RMI?

39. Can Rmi registry be written in the code, without having to

write

40. it in the command prompt and if yes where?

41. Why is Socket used ?

Java Interview Questions


12


220. When MalformedURLException and UnknownHost Exception throws

?

244. What is meant by RMI ?

245. Explain RMI Architecture ?

246. What is meant by a stub ?

247. What is meant by a skelotn ?

248. What is meant by serialisation and deserialisation ?

249. What is meant by RRL ?

250. What is the use of TL ?

251. What is RMI Registry ?

252. What is rmic ?

253. How will you pass parameter in RMI ?

254. What exceptions are thrown by RMI ?

255. What are the steps involved in RMI ?

256. What is meant by bind(), rebind(), unbind() and lookup()

methods

257. What are the advanatages of RMI ?

258. What is JNI ?

259. What is Remote Interface ?

260. What class is used to create Server side object ?

261. What class is used to bind the server object with RMI

Registry ?

262. What is the use of getWriter method ?

277. Explain RMI Architecture?

284. What is the difference between RMI & Corba ?

285. What are the services in RMI ?

311. In RMI, server object first loaded into the memory and then

the stub

312. Reference is sent to the client ? or whether a stub reference

is directly sent to the client ?

313. Suppose server object is not loaded into the memory, and

the

314. Client request for it , what will happen?

315. What is serialization ?

316. Can you load the server object dynamically? If so, what are

the

317. Major 3 steps involved in it ?

318. What is difference RMI registry and OSAgent ?

319. To a server method, the client wants to send a value 20, with

this value

320. exceeds to 20,. a message should be sent to the client ?

What

321. will you do for achieving for this ?

329. Can you run the product development on all operating systems

?

334. Can we send object using Sockets ?

Java Interview Questions


13


335. What is the RMI and Socket ?

338. What is the protocol used by server and client ?

339. Can I modify an object in CORBA ?

340. What is the functionality stubs and skeletons ?

366. What is an RMI?

367. How will you pass parameters in RMI ? Why u serialize?

370. What is the main functionality of the Remote Reference Layer

?

371. How do you download stubs from a Remote place ?

374. I want to store more than 10 objects in a remote server ?

Which

375. Methodology will follow ?

389. Write a program on RMI and JDBC using StoredProcedure ?

400. What is meant by distributed Application ? Why we are using

that in our applications ?

401. What is the functionality of the stub ?

453. How to generate skeleton & Stub classes

454. Explain lazy activation

455. Firewalls in RMI

GENERAL

337. What are the files generated after using IDL to Java Compilet

?

8.Few shell script commands in linux.

9.What are all the code optimization techniques?

10.About heap memory.

11.How performance of a code can be improved?

1. What are the steps to be considered in code review.

13. Explanation about managing the connections in the application.

17. How to change the ownership of a file(Linux).

18. How to change the password of the root(Linux).

363. What is the middleware ? What is the functionality of

Webserver ?

402. Have you used any version control ?

405. Explain 2 tier and 3 -tier Architecture ?

407. How have you done validation of the fileds in your project

?

408. What is the main difficulties that you are faced in your

project

409. ?

Java Interview Questions


14


1. what are the types of test plans? unit test plan,integration test plan,system test

plan....

2. how will u analyze the problem .. ithukku ellam chumma kathai viten....

3. how will you do designing? ithukku ellam chumma kathai viten....

4. Questions in UML...they gave an example(requirement) and asked me to design for

it.they asked me to do DB design too.

5. relationships b/w objects..in UML. can be depicted in Collaboration and sequence

diagrams..gave an example

6. Diff types of diagram and the purpose of it.

usecase,class,object,collabration,sequence,implementation(since u dont have this

in ur resume..sont worry abt it)

7. when any problem given to you..how will you approach? -Kathai

8. If you join in the middle of the project and a module has been allocated to you

(which is already in coding phase).what will u do initially? -u shud not say -that u

i'll start coding....u shud say---"first,i'll try to understand the req,purpose of my

module ..its relation with other modules etc.,then designing,with the chklist of

conventions and std i'll start coding..."

9. then ques in XML,XSL. -explained its usgae with intranet.

10. its better u search for answers for the following ques..my answers may misguide

you

11. difference b/w entity beans and session beans in EJB.

12. advantage of EJB.

13. adv of application servers -weblogic,websphere.

14. some views on web architecture.

15. something abt ATL COM.

16. about Processing of JSP pages.