© 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

23. What is the result of compiling the following code? When you run like given below?
java Test Hello How Are You
public class Test {
public static void main ( String[] args) {
for ( int i = 0; i < args.length; i++)
System.out.print(args[i]);
}
}
[a] Compile and runs with no output
[b] Compiles and runs printing out HelloHowAreYou
[c] Does not compile
[d] Compiles but generates run time error

Answer
[b] Compiles and runs printing out HelloHowAreYou

24. Which of the following are Java keywords or reserved words?
[a] goto
[b] synchronized
[c] extends
[d] implements
[e] this
[f] NULL

Answer
[a] goto
[b] synchronized
[c] extends
[d] implements
[e] this

25. Which of the following are Java keywords ?
[a] class
[b] transient
[c] native
[d] Double
[e] switch

Answer
[a] class
[b] transient
[c] native
[e] switch

26. What is the result when you compile and run the following code?
public class TestMember {
String s ;
int intStr ;
public static void main(String args[]) {
TestMember t = new TestMember();
System.out.print(t.s + " " + t.intStr);
}
}
[a] A null is printed
[b] Compile time error
[c] Nothing is printed
[d] null followed by 0 is printed on the screen

Answer
[d] null followed by 0 is printed on the screen

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