Java Basics - Interview Questions XIII


79. What is the catch or declare rule for method declarations?
If a checked exception may be thrown within the body of a method, the method must either catch the exception or declare it in its throws clause.
80. Is Empty .java file a valid source file?
Yes. An empty .java file is a perfectly valid source file.
81. Can a .java file contain more than one java classes?
Yes. A .java file contain more than one java classes, provided at the most one of them is a public class.
82. Is String a primitive data type in Java?
No. String is not a primitive data type in Java, even though it is one of the most extensively used object. Strings in Java are instances of String class defined in java.lang package.
83. Is main a keyword in Java?
No. main is not a keyword in Java.
84. Is next a keyword in Java?
No. next is not a keyword.

Comments