What is a task’s priority and how is it used in scheduling?
A task’s priority is an integer value that identifies the relative order in which it should be executed with respect to other tasks. The scheduler attempts to schedule higher priority tasks before lower priority tasks.
To what value is a variable of the String type automatically initialized?
The default value of a String type is null.
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. Synchronized statements are similar to synchronized methods. A synchronized statement can only be executed after a thread has acquired the lock for the object or class referenced in the synchronized statement.
Can an unreachable object become reachable again?
An unreachable object may become reachable again. This can happen when the object’s finalize() method is invoked and the object performs an operation which causes it to become accessible to reachable objects.
How do I serialize an object to a file?
The class whose instances are to be serialized should implement an interface Serializable. Then you pass the instance to the ObjectOutputStream which is connected to a Fileoutputstream. This will save the object to a file.
Which methods of Serializable interface should I implement?
The serializable interface is an empty interface, it does not contain any methods. So we do not implement any methods
0 Comments
How can I customize the seralization process? i.e. how can one have a control over the serialization process? Does importing a package imports the subpackages as well? How does an exception permeate through the code? How can one prove that the array is not null but empty using one line of code? What if the main method is declared as private? What methods can be overridden in Java? What does the “abstract” keyword mean in front of a method? A class? How can you force all derived classes to implement a method present in the base class? How is rounding performed under integer division? |