© 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 Operators ▼

Java Interview Questions On Operators

25. What will be the result of following program?
public class MyClass {
public static void main(String args[]) {
Object obj = new Object();
Object obj1 = new Object();
if ( obj == obj1 ) {
System.out.println("Both are equal");
}else {
System.out.println("Both are not equal");
}
}
}
[a] Compile time error
[b] Both are equal
[c] No output
[d] Runtime error
[e] Both are not equal

Answer
[e] Both are not equal

 

26. Select the correct answer form the list of answers?
public class TestBit {
public static void main(String args[]) {
String s = "Hello World";
if ((s != null) && (s.length() > 6))
System.out.println("The value of s is " + s );
}
}
[a] Compile time error
[b] Runtime error
[c] No output is printed
[d] The value of s is Hello World is printed on the screen

Answer
[d] The value of s is Hello World is printed on the screen

27. Given the following declarations which of the following statements equals to true?
Boolean b1 = true;
Boolean b2 = false;
[a] b1 == b2;
[b] b1 || b2;
[c] b1 |& b2;
[d] b1 && b2;

Answer
[b] b1 || b2;

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