Top 100 java interview Question

 Questions


1) What is the difference between String and StringBuffer...and what is that property called for String objects?


2) What will happen if u get an error in run() method of thread and if there is no try catch block for that?


3) What is Synchronization?


4) What is deadlock?


5) Write sample code using wait() and notify() methods?


6) If a thread has obtained a lock on an object. can other threads invoke non-synchronized methods on the same object?


7) Explain the Exception hierarchy?


8) What are the diff b/w checked exceptions and unchecked exceptions and errors?


9) How to write our own exceptions? And can we write them without using super() in that?


10) What is encapsulation? Why do u need that?


11) Difference b/w Readers and Streams in I/O?


12) How to open a file in read write mode?


13) There is a Date class in java.util. Is there any other package that has the Date class?


14) If we import java.util.Date and java.sql.Date and use Date d= new Date()..what happens?


15) What is the difference between Vector and ArrayList?


16) What is the alternate for HashTable?


17) What is the difference b/w iterator and enumeration?


18) How can u sort a collection?


19) What is the difference between function and stored procedures?


20) At what all places is the "Scope" attribute used in JSP?


21) What are the different ways for loading a DataBase driver..(apart from using Class.forName())?


22) After connecting and fetching the data into the result set and closing the connection without closing the statement and result set can we now fetch values from the resultset?


23) After fetching data into the resultset and then removing the wire from the system connecting to database. can we print values from the resultset now?


24) Different types of drivers...explain exactly their differences and when to go for what?


25) Significance of BufferedReaders over others?


26) Difference b/w TCP and UDP connection?


27) What is the difference b/w synchronous and asynchronous property in JMS and TCP/UDP?


28) What are the different modes of communication in JMS and the difference b/w them?


29) Different types of statements and their differences? What is the significance of the Prepared statement?


30) Can we have a scrollable result set?


31) How can we get interthread communication?


32) What is the advantage of implementing a Runnable interface rather than extending the Thread class?


33) Different methods of threads...that makes the running thread to stop running and go to some other state? And the difference b/w those methods?


34) JSP life cycle


35) Moving from one JSP to another


36) Methods of the life cycle in JSP


37) How to create a jar file


38) Serialization & its methods


39) the life cycle of servlets


40) JSP forward() and include()


Comments