Set - 2

Question 16 :

What is the difference between the Boolean & operator and the && operator?

Answer :

If an expression involving the Boolean & operator is evaluated, both operands are evaluated. Then the & operator is applied to the operand. When an expression involving the && operator is evaluated, the first operand is evaluated. If the first operand returns a value of true then the second operand is evaluated. The && operator is then applied to the first and second operands. If the first operand evaluates to false, the evaluation of the second operand is skipped.
Operator & has no chance to skip both sides evaluation and && operator does. If asked why, give details as above.


Question 17 :

When is the ArithmeticException throwQuestion: What is the GregorianCalendar class?

Answer :

The GregorianCalendar provides support for traditional Western calendars.


Question 18 :

What is the SimpleTimeZone class?

Answer :

The SimpleTimeZone class provides support for a Gregorian calendar.


Question 19 :

How can a subclass call a method or a constructor defined in a superclass?

Answer :

Use the following syntax: super.myMethod(); To call a constructor of the superclass, just write super(); in the first line of the subclass's constructor.


Question 20 :

What is the Properties class?

Answer :

The properties class is a subclass of Hashtable that can be read from or written to a stream. It also provides the capability to specify a set of default values to be used.