Menu
Topics Index
...
`

Motors Manufacturers


If you need explanation Read this topic

If you need Answer Take test on this topic

Motors Manufacturers
What will be the output of the following program?
public class Industries {
    public static void main(String[] args) {
        {
            String name = "TEXMO";
            System.out.println(name + " Industries");
        }
        name = "texmo";
        System.out.println(name + " Industries");
    }
}

A. TEXMO Industries
texmo Industries
B. TEXMO Industries
TEXMO Industries
C. Compilation Error
D. Runtime Error
Topic: Scope Of Variables In Nested/Multiple Blocks

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.

Ans is D because string is immutable and string buffer is immutable

Posted by Vivek Roshan    2014-03-14 13:07:31


ans is C because string name is declared in a block so it can not be accessed outside the block it gives compilation error

Posted by Sheshu Kumar    2014-03-14 13:16:33


C

Posted by Gopinath Manchikanti    2014-03-15 08:20:31


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

Posted by Merit Campus    2014-03-17 04:23:13


© meritcampus 2019

All Rights Reserved.

Open In App