91-9990449935 0120-4256464 |
Java Garbage Collection, I/O Stream, Serialziation and Networking interview questionsGarbage Collection Interview Questions117) What is Garbage Collection?Garbage collection is a process of reclaiming the runtime unused objects.It is performed for memory management. more details...118) What is gc()?gc() is a daemon thread.gc() method is defined in System class that is used to send request to JVM to perform garbage collection. 119) What is the purpose of finalize() method?finalize() method is invoked just before the object is garbage collected.It is used to perform cleanup processing. 120) Can an unrefrenced objects be refrenced again?Yes. 121)What kind of thread is the Garbage collector thread?Daemon thread. 122)What is difference between final, finally and finalize?
123)What is the purpose of the Runtime class?The purpose of the Runtime class is to provide access to the Java runtime system. 124)How will you invoke any external process in Java?By Runtime.getRuntime().exec(?) method. I/O Interview Questions125)What is the difference between the Reader/Writer class hierarchy and the InputStream/OutputStream class hierarchy?The Reader/Writer class hierarchy is character-oriented, and the InputStream/OutputStream class hierarchy is byte-oriented. 126)What an I/O filter?An I/O filter is an object that reads from one stream and writes to another, usually altering the data in some way as it is passed from one stream to another. Serialization Interview Questions127) What is serialization?Serialization is a process of writing the state of an object into a byte stream.It is mainly used to travel object's state on the network. more details...128) What is Deserialization?Deserialization is the process of reconstructing the object from the serialized state.It is the reverse operation of serialization. 129) What is transient keyword?If you define any data member as transient,it will not be serialized.more details... 130)What is Externalizable?Externalizable interface is used to write the state of an object into a byte stream in compressed format.It is not a marker interface. 131)What is the difference between Serializalble and Externalizable interface?Serializable is a marker interface but Externalizable is not a marker interface.When you use Serializable interface, your class is serialized automatically by default. But you can override writeObject() and readObject() two methods to control more complex object serailization process. When you use Externalizable interface, you have a complete control over your class's serialization process. Networking Interview Questions132)How do I convert a numeric IP address like 192.18.97.39 into a hostname like java.sun.com?By InetAddress.getByName("192.18.97.39").getHostName() where 192.18.97.39 is the IP address. Reflection Interview Questions133) What is reflection?Reflection is the process of examining or modifying the runtime behaviour of a class at runtime.It is used in:
134) Can you access the private method from outside the class?Yes, by changing the runtime behaviour of a class if the class is not secured. more details...
Next TopicJava Miscellaneous interview Questions
|