Core Java - Interview Questions XIV


Q. Is null a keyword?
The null value is not a keyword.
86. Which characters may be used as the second character of an identifier, but not as 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.
Q. Is the ternary operator written x : y ? z or x ? y : z ?
It is written x ? y : z.
Q. How is rounding performed under integer division?
The fractional part of the result is truncated. This is known as rounding toward zero.
Q. If a class is declared without any access modifiers, where may the class be accessed?
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.
Q. Does a class inherit the constructors of its superclass?
A class does not inherit constructors from any of its superclasses.

Comments