-
What is 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 int values. The int values are also convertedto long values, if necessary. The long and float values are converted to double values, asrequired.
-
What is a Java package and how is it used
A Java package is a naming context for classes and interfaces. A package is used tocreate a separate name space for groups of classes and interfaces. Packages are also usedto organize related classes and interfaces into a single API unit and to controlaccessibility to these classes and interfaces.
-
What are synchronized methods and synchronized statements
Synchronized methods are methods that are used to control access to an object. A threadonly executes a synchronized method after it has acquired the lock for the method'sobject or class. Synchronized statements are similar to synchronized methods. Asynchronized statement can only be executed after a thread has acquired the lock for theobject or class referenced in the synchronized statement.
-
What are the two basic ways in which classes that can be run as threads may bedefined
A thread class may be declared as a subclass of Thread, or it may implement theRunnable interface.
-
What are the problems faced by Java programmers who don't use layout managers
Without layout managers, Java programmers are faced with determining how their GUIwill be displayed across multiple windowing systems and finding a common sizing andpositioning that will work within the constraints imposed by each windowing system.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
How are Observer and Observable used
Objects that subclass the Observable class maintain a list of observers. When anObservable object isupdated it invokes the update() method of each of its observers to notify the observersthat it has changedstate. The Observer interface is implemented by objects that observe Observable objects.
-
What is synchronization and why is it important
With respect to multithreading, synchronization is the capability to control the access ofmultiple threads toshared resources. Without synchronization, it is possible for one thread to modify ashared object whileanother thread is in the process of using or updating that object's value. This often leadsto significanterrors.
Java Interview Questions
Ans