Core Java Interview Questions – Set 15

Which characters may be used as the second character of an identifier, but not s the first character of an identifier?

The digits 0 through 9 may not be used as the first character of an identifier but they may be used after the first character of an identifier

What is an abstract method

An abstract method is a method whose implementation is deferred to a subclass.

What is the SimpleTimeZone class

The SimpleTimeZone class provides support for a Gregorian calendar.

Can try statements be nested

Try statements may be tested.

What are different types of operators in Java

– Uniary ++, –, +, -, |, ~, ()

– Arithmetic *, /, %,+, –

-Shift <<, >>, >>>

– Comparison =, instanceof, = =,!=Bitwise &, ^, |Short Circuit &&, ||

Ternary ?:Assignment =

Via the class name

Code:

Computer.harddisk

Computer.compute()

Are true and false keywords

The values true and false are not keywords.

What is the difference between a static and a non-static inner class

A non-static inner class may have object instances that are associated with instances of the class’s outer class.

A static inner class does not have any object instances.

How are the elements of a CardLayout organized

The elements of a CardLayout are stacked, one on top of the other, like a deck of cards.

Can protected or friendly features be accessed from different packages

No when features are friendly or protected they can be accessed from all the

classes in that package but not from classes in another package