MyClass c1, c2, c3;
c1 = new MyClass ();
c3 = new MyClass ();
Only 2 objects are created, c1 and c3. The reference c2 is only declared and not initialized.
102. 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.
103. Can main method be declared final?
Yes, the main method can be declared final, in addition to being public static.
104. What will be the output of the following statement?
System.out.println ("1" + 3);
It will print 13.
105. What will be the default values of all the elements of an array defined as an instance variable?
If the array is an array of primitive types, then all the elements of the array will be initialized to the default value corresponding to that primitive type. e.g. All the elements of an array of int will be initialized to 0, while that of boolean type will be initialized to false. Whereas if the array is an array of references (of any type), all the elements will be initialized to null.
106. What is the Collections API?
The Collections API is a set of classes and interfaces that support operations on collections of objects
107. What is the List interface?
The List interface provides support for ordered collections of objects.
108. What is the Vector class?
The Vector class provides the capability to implement a growable array of objects.
109. What is an Iterator interface?
The Iterator interface is used to step through the elements of a Collection
110. Which java.util classes and interfaces support event handling?
The EventObject class and the EventListener interface support event processing
0 comments:
Post a Comment