What will be the output of the following Java program?

class string_class 
{
    public static void main(String args[])
    {
        String obj = "hello";
        String obj1 = "world";   
        String obj2 = obj;
        obj2 = " world";
        System.out.println(obj + " " + obj2);
    }
}

a) hello hello
b) world world
c) hello world
d) world hello

1 thought on “What will be the output of the following Java program?”

Leave a Comment