3.
What will be the output of the following Java program, Command line execution is done as - java Output "This is a command Line"?
class Output 
{
    public static void main(String args[]) 
    {
        for (String arg : args)
        {
            System.out.print(arg);
        }
    }
}

5.
What will be the output of the following Java snippet, if attempted to compile and execute?
class abc
{
    public static void main(String args[])
    {
        if(args.length>0)
        System.out.println(args.length);
    }
}

6.
What will be the output of the following Java program?
class static_out 
{
    static int x;
static int y;
    void add(int a , int b)
    {
        x = a + b;
        y = x + b;
    }
}    
class static_use 
{
    public static void main(String args[])
    {
        static_out obj1 = new static_out();
        static_out obj2 = new static_out();   
        int a = 2;
        obj1.add(a, a + 1);
        obj2.add(5, a);
        System.out.println(obj1.x + " " + obj2.y);     
    }
}

7.
What is the use of @syntax?

9.
What will be the output of the following Java program?
class access
{
   static int x;
   void increment()
   {
       x++;
   }   
 }   
class static_use 
{
    public static void main(String args[])
    {
        access obj1 = new access();
        access obj2 = new access();
        obj1.x = 0;   
        obj1.increment();
        obj2.increment();
        System.out.println(obj1.x + " " + obj2.x);
     }
}

10.
What will be the output of the following Java program, Command line execution is done as - "java Output This is a command Line"?
class Output 
{
    public static void main(String args[]) 
    {
        System.out.print(args[0]);
    }
}

Read More Section(Miscellaneous in Java)

Each Section contains maximum 100 MCQs question on Miscellaneous in Java. To get more questions visit other sections.