Home Tutorial Java Scjp Part1 SCJP Module-1 Question-21


Share on Google+Share on Google+
SCJP Module-1 Question-21
Posted on: July 21, 2010 at 12:00 AM
The sample code given below will test your understanding about the simple Java logics of the program.

Given a sample code:

1    class Test {
2    public static void main(String[] args) {
3    int x = 4;
4    boolean bl1 = false;
5    boolean bl2 = true;

6    if ((x == 3) && !bl2)
7    System.out.print("hello");
8    System.out.print("hi");

9    if ((bl2 = true) && bl1)
10 System.out.print("bye");

What will be the result? Choose the correct option?

(A) hello
(B) hi
(C) bye
(D) Compilation error at line no 9.




Related Tags for SCJP Module-1 Question-21:

Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: July 21, 2010

Recommend the tutorial

Advertisements Advertisements