Java Basics Interview Questions and Answers For Freshers and Experience Part-15
97. Difference between Swing and Awt? AWT are heavy-weight componenets. Swings are light-weight components. Hence swing works faster than AWT.
Read MoreSalesforce.com Lightning and Lightning Web Component – Learn & Share
97. Difference between Swing and Awt? AWT are heavy-weight componenets. Swings are light-weight components. Hence swing works faster than AWT.
Read More91. Can a public class MyClass be defined in a source file named YourClass.java? No. The source file name, if it contains a public class, must be the same as the public class name itself with a.java extension.
Read More85. Is delete a keyword in Java? No. delete is not a keyword in Java. Java does not make use of explicit destructors the way C++ does. 86. Is exit a keyword in Java? No. To exit a program explicitly…
Read More79. What is the catch or declare rule for method declarations? If a checked exception may be thrown within the body of a method, the method must either catch the exception or declare it in its throws clause.
Read More73. What are synchronized methods and synchronized statements? Synchronized methods are methods that are used to control access to an object. A thread only executes a synchronized method after it has acquired the lock for the method’s object or class.…
Read More67. What is daemon thread and which method is used to create the daemon thread? Daemon thread is a low priority thread which runs intermittently in the back ground doing the garbage collection operation for the java runtime system.setDaemon method…
Read More61. What is the purpose of finalization? The purpose of finalization is to give an unreachable object the opportunity to perform any cleanup processing before the object is garbage collected.
Read More55. If I write System.exit(0); at the end of the try block, will the finally block still execute? No. In this case the finally block will not execute because when you say System.exit(0); the control immediately goes out of the…
Read More49. If I want an object of my class to be thrown as an exception object, what should I do? The class should extend from Exception class. Or you can extend your class from some more precise exception type also.
Read More37. What is Externalizable interface? Externalizable is an interface which contains two methods readExternal and writeExternal. These methods give you a control over the serialization mechanism. Thus if your class implements this interface, you can customize the serialization process by…
Read More