Menu
Topics Index
...
`

Block Of Code


If you need explanation Read this topic

If you need Answer Take test on this topic

Block Of Code
What will be the output of the following program?
public class BlockOfCode {
    public static void main(String[] args) {
        System.out.println("Main");
        {
            System.out.println("Bolck 1");
        }
        {
            System.out.print("Bolck 2, ");
            {
                System.out.print("Bolck 2.1, ");
                {
                    System.out.println("Bolck 2.1.1");
                }
            }
        }
        {
            System.out.println("Bolck 3");
        }
    }
}

A. Main
Bolck 1
Bolck 2, Bolck 3
Bolck 2.1, Bolck 2.1.1
B. Main
Bolck 1
Bolck 2, Bolck 2.1, Bolck 2.1.1
Bolck 3
C. Compilation Error
D. Runtime Error
Topic: Block Of Code In Java

If you need explanation Read this topic

If you need Answer Take test on this topic

User comments below. All of them might not be correct.

answer is B

Posted by Shiva Goud    2014-01-16 04:47:53


Ans C As we cannot have non static blocks in static methods...

Posted by Ram Reddy Bitla    2014-01-16 04:53:09


answer B

Posted by Venkateshwarlu Neredukomma    2014-01-16 05:20:31


ans is c

Posted by Maheshwar Konda    2014-01-16 08:58:16


Answer is B .. SOP is  printed Orderly.

Posted by Asad Ahmed    2014-01-16 09:00:48


B

Posted by Shravan Kumar    2014-01-16 15:08:02


Congratulations Shiva Kumar. You are this dose winner. We will send you the link using which you can claim your recharge.

Posted by Merit Campus    2014-01-17 03:55:05


© meritcampus 2019

All Rights Reserved.

Open In App