- Home
- Interview Questions
- Core Java
21.
The modifiers that may be used with a top-level class?
The modifiers that may be public,abstract or final.
22.
Difference between the public and non public class ?
A public class can be accessed outside of its package, but a non-public class may not be accessed outside of its package.
23.
Define Numeric Promotion.
Numeric promotion is the conversion of a smaller numeric type to a larger numeric type, so that integer and floating-point operations may take place. In numerical promotion, byte, char, and short values are converted to intvalues. The int values are also converted to long values, if necessary. The long and float values are converted to double values, as required.
24.
What is the use of ResourceBundle class?
The ResourceBundle class is used to store locale-specific resources that can be loaded by a program to tailor the program's appearance to the particular locale in which it is being run.
25.
Define Layout Manager ?
A layout manager is an object that is used to organize components in a container.
26.
when you invoke a thread's interrupt method while it is sleeping or waiting what will happen?
When a task's interrupt() method is executed, the task enters the ready state. The next time the task enters the running state, an InterruptedException is thrown.
27.
When is the finally clause of a try-catch-finally statement executed?
The finally clause of the try-catch-finally statement is always executed unless the thread of execution terminates or an exception occurs within the execution of the finally clause.
28.
When does the compiler supply a default constructor for a class?
If no other constructors are provided then The compiler supplies a default constructor for a class.
29.
Difference between a while statement and a do statement ?
A while statement checks at the beginning of a loop to see whether the next loop iteration should occur. A do statement checks at the end of a loop to see whether the next iteration of a loop should occur. The do statement will always execute the body of a loop at least once.
30.
What is the relationship between an event-listener interface and an event-adapter class?
An event-listener interface defines the methods that must be implemented by an event handler for a particular kind of event. An event adapter provides a default implementation of an event-listener interface.