Set - 1

Question 46 :

What can go wrong if you replace &emp;&emp; with &emp; in the following code: 

String a=null; 
if (a!=null && a.length()>10) 
{...}

 

Answer :

A single ampersand here would lead to a NullPointerException.


Question 47 :

What is the Vector class?

Answer :

The Vector class provides the capability to implement a growable array of objects


Question 48 :

What modifiers may be used with an inner class that is a member of an outer class?

Answer :

A (non-local) inner class may be declared as public, protected, private, static, final, or abstract.


Question 49 :

If a method is declared as protected, where may the method be accessed?

Answer :

A protected method may only be accessed by classes or interfaces of the same package or by subclasses of the class in which it is declared.


Question 50 :

What is an Iterator interface?

Answer :

The Iterator interface is used to step through the elements of a Collection.