Void f() throws ioexception which of the following is/are correct overriding method? a) void f() throws ioexception b) public void f() c) void f() throws filenotfoundexception d) void f() throws exception
How many methods in the serializable interface?
There is no method in the serializable interface. The serializable interface acts as a marker, telling the object serialization tools that your class is serializable.
There is no methods in serializable interface. It is a marker interface and null interface.
Does not have any methods in Serializable interface......
What is the difference between class.Forname and registerdriver()
class.forName("full qualm name"); is used to load the driver explicitly and DriverManger.registerDriver(new classname()); will implicitly loads the driver automatically
class.forName() is a method ,this method takes a string representing a fully qualified class name(one that includes the package name) and loads the corresponding class.
The locale class is used to tailor program output to the conventions of a particulargeographic, political, orcultural region.
what is object class in java?
the locale class to used to tailor program output to the conventions of a particular geographic, political, or cultural region
Difference between compareto and equals method.
CompareTo method which is present in the String class is used to check the two strings. It checks each character with the other String and if found equals then returns 0. Else negative value or positi...
CompareTo() method is derived from Comparable interface and is used to find the Ordering of Strings.
equals() method is from java.lang.Object and used for comparing objects.
What is the difference between preemptive scheduling and time slicing
Under preemptive scheduling, the highest priority task executes until it enters the waitingor dead states or a higher priority task comes into existence. Under time slicing, a taskexecutes for a predefined slice of time and then reenters the pool of ready tasks. Thescheduler then determines which task...
Preemptive scheduling enables the highest priority task execution until waiting or dead states entered. It also executes, until a higher priority task enters. Time slicing allows a task to execute fo...
preemptive Scheduling:- the highest priority thread executes First that means when one thread is in running state that time the highest priority interrupt enters then this interrupt will executes firs...
What is the difference between list, set and map
Adding couple of other differences between Set and Map:
1. You can have an iterator for a set but not a map.
2. Processing a complete map takes longer whereas processing a complete set takes a comparatively less time (reason - iterator)
A Set is a collection that has no duplicate elements.
A List is a collection that has an order assoicated with its elements.
A map is a way of storing key/value pairs. The way of storing a Map is similar to two-column table.
What is the difference between static and non-static variables
A static variable is associated with the class as a whole rather than with specific instancesof a class. Non-static variables take on unique values with each object instance.
STATIC VARIABLE
1)outclass is called static variable
2)static variable access member of its enclosing class through on object.
NON-STATIC VARIABLE
1)inner class is called non-static variable
2)nested class and it has access to all of the variable and methods object of its earlier.
Static variable: 1)Memory allocated before creation of object. 2)static variables are class variables and the values remains same fr the whole class and its value is same for all classes in a program...
Can an unreachable object become reachable again
An unreachable object may become reachable again. This can happen when the object'sfinalize() method isinvoked and the object performs an operation which causes it to become accessible toreachable objects.
yes it is possible.using finalize in garbage collection
No, an unreachable object cannot be reached again.
What is the default size of vector, arraylist, hashtable, hashmAP, hashset in Java?
ArrayList , Vector default size is 10. vector increment is 10 and array list is 10/2
Instead of 30 it would give 40.
What restrictions are placed on the values of each case of a switch statement
During compilation, the values of each case of a switch statement must evaluate to avalue that can bepromoted to an int value.
1.The compiler does not initialize auto and register variables at the beginning of a switch body where as we can put data definitions at the beginning of the switch body.
2.We cannot use a switch statement to jump over initializations.
What is the difference between the paint() and repaint() methods
The paint() method supports painting via a graphics object. The repaint() method is usedto cause paint() tobe invoked by the awt painting thread.
Whenever the window needs to be refreshed the paint() method is called automatically.The user does not specify the paint(). The user specifies the repaint() in order to obtain a rendering.repaint() i...
What method must be implemented by all threads
All tasks must implement the run() method, whether they are a subclass of thread orimplement therunnable interface.
The run() method must be implemented by all the threads.
What is the difference between a public and a non-public class
A public class may be accessed outside of its package. A non-public class may not beaccessed outside ofits package.
We can access a public class out of its package where as the access outside the package is not possible with a non public class.
An i/o filter is an object that reads from one stream and writes to another, usuallyaltering the data in someway as it is passed from one stream to another.
To read from one stream and then to write on other stream we use i/o filter.
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 threADOf executionterminates or an exception occurs within the execution of the finally clause.
The finally clause of a try-catch-finally statement executed when the thread of execution terminates or an exception occurs within the execution of the finally clause.
A method's throws clause must declare any checked exceptions that are not caught withinthe body of themethod.
Any checked exceptions that are not caught within the body of the method must declare in a methods throws clause.
What is the collection interface
The collection interface provides support for the implementation of a mathematical bag -an unorderedcollection of objects that may contain duplicates.
The Collection interface is used to pass around collections of objects where maximum generality is desired.It is one of the root interfaces of the Java collection classes.It provides support for the implementation of an unordered collection of objects that may contain duplicates.
What is the relationship between clipping and repainting
When a window is repainted by the awt painting thread, it sets the clipping regions tothe area of thewindow that requires repainting.
Clipping regions are set to the repinted window on the area that requires repainting.When a window is repainted by the AWT painting thread, it sets the clipping regions tothe area of the window that requires repainting.
Q: why are Java archive (jar) files important?
Jar files bundle .Class files and optimize applet downloads.
Jar files are important as it contains the class, image, and sound files for a Java application or applet gathered into a single file and possibly compressed. When a programmer gets a Java program dev...
a) void f() throws ioexception Bcoz the overriding method must NOT throw checked exceptions that are new or broader than those declared by the overridden method. For example, a method that declares a...