Provided by http://www.freewebs.com/hemanthb2005/index.htm
2Looks like a comment No output is displayedAns : a.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 statementIt must be named Test.javaIt must import java.langIt must declare a public class named TestAns : b11) 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 : void13) 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 comment2) /* --*/ multiple line comment3) /** --*/ documentation16) What is the difference between constructor method and method?Ans : Constructor will be automatically invoked when an object is created. Whereas methodhas 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 Libcontains all packages and variables.
Data types,variables and Arrays
1) What is meant by variable?Ans: Variables are locations in memory that can hold values. Before assigning any value to avariable, it must be declared.2) What are the kinds of variables in Java? What are their uses?Ans: Java has three kinds of variables namely, the instance variable, the local variable and theclass variable.Local variables are used inside blocks as counters or in methods as temporary variables and areused to store information needed by a single method.