Monday, 13 February 2012

When does the compiler supply a default constructor for a class? | Core Java

The compiler supplies a default constructor for a class if no other constructors are provided.

What modifiers can be used with a local inner class? | Core Java

A local inner class may be final or abstract.

What is the difference between a while statement and a do statement? | Core Java

A while statement checks at the beginning of a loop to see whether the next loop iteration should occur. A do statement checks at the end of a loop to see whether the next iteration of a loop should occur. The do statement will always execute the body of a loop at least once.

What restrictions are placed on the values of each case of a switch statement? | Core Java

During compilation, the values of each case of a switch statement must evaluate to a value that can be promoted to an int value.

Name the eight primitive Java types? | Core Java

The eight primitive types are byte, char, short, int, long, float, double, and boolean.

Does a class inherit the constructors of its superclass? | Core Java

A class does not inherit constructors from any of its superclasses.

If a class is declared without any access modifiers, where may the class be accessed? | Core Java

A class that is declared without any access modifiers is said to have package access. This means that the class can only be accessed by other classes and interfaces that are defined within the same package.