Java Interview:

10) In order for a source code file, containing the public class
Test, to successfully compile, which of the following must be true?
It must have a package statement
It must be named Test. java
It must import java.lang
It must declare a public class named Test
Ans : b

11) What are identifiers and what is naming convention?
Ans : Identifiers are used for class names, method names and variable names.
An identifier may be any descriptive sequence of upper case & lower case letters,
numbers or underscore or dollar sign and must not begin with numbers.

12) What is the return type of program’s main( ) method?
Ans : void

13) What is the argument type of program’s main( ) method?
Ans : string array.

14) Which characters are as first characters of an identifier?
Ans : A – Z, a – z, _ ,$

15) What are different comments?
Ans : 1) // — single line comment
2) /* —
*/ multiple line comment
3) /** —
*/ documentation

16) What is the difference between constructor method and method?
Ans : Constructor will be automatically invoked when an object is created.
Whereas method has to be call explicitly.

17) What is the use of bin and lib in JDK?
Ans : Bin contains all tools such as javac, applet viewer, awt tool etc.,
whereas Lib contains all packages and variables.

Ref Link contributor : http://www.hudihudi.com/placement/java/javabasic2.htm

Permanent link to Java Tutorials : http://www.freshersinterviewquestions.com/java-tutorials…ew-questions-2/