© 2014 Firstsoft Technologies (P) Limited. login
Hi 'Guest'
Home SiteMap Contact Us Disclaimer
enggedu

Home Placements Interview Questions Java Interview Questions And Answers Java Interview Questions On Variables ▼

Java Interview Questions On Variables

18. Select all valid identifiers from the following?
[a] 1hello
[b] _hello
[c] $hello
[d] #hello

Answer
[b] _hello
[c] $hello

19. What is the correct order in list given below?
[a] package, import, class
[b] class, import, package
[c] import, package, class
[d] package, class, import

Answer
[a] package, import, class

20. Select the correct anonymous inner class declaration ?
[a] new Outer.new Inner
[b] new Inner() { }
[c] new Inner()
[d] Outer.new Inner()

Answer
[b] new Inner() { }

21. Select all the correct choices from the following statements?
[a] A static modifier may not be applied to an inner class
[b] An inner class can have explicit constructors
[c] An inner class may implement an interface, or extend other classes
[d] Anonymous inner classes must be instantiated at the same point they are defined.

Answer
[b] An inner class can have explicit constructors
[c] An inner class may implement an interface, or extend other classes
[d] Anonymous inner classes must be instantiated at the same point they are defined.

22. What is the result of compiling the following code?
public class Test {
public static void main ( String[] args) {
int value;
value = value + 1;
System.out.println(" The value is : " + value);
}
}
[a] Compile and runs with no output
[b] Compiles and runs printing out "The value is 1"
[c] Does not compile
[d] Compiles but generates run time error

Answer
[c] Does not compile

Previous Next
1 2 3 4 5 6
SLogix Student Projects
bottom