0
What is the output of the following Java program?

Open 1 Answers 54 Views Education
What is the output of the following Java program?

What is the output of the following Java program?

class Test   

{  

    public static void main (String args[])   

    {  

        for(int i=0; 0; i++)   

        {  

            System.out.println("Hello Javatpoint");  

        }  

    }  

}

1 Answer

0

What is the output of the following Java program?

class Test   

{  

    public static void main (String args[])   

    {  

        for(int i=0; 0; i++)   

        {  

            System.out.println("Hello Javatpoint");  

        }  

    }  

}  

The above code will give the compile-time error because the for loop demands a boolean value in the second part and we are providing an integer value, i.e., 0.

There is given more than 50 OOPs (Object-Oriented Programming and System) interview questions. However, they have been categorized in many sections such as constructor interview questions, static interview questions, Inheritance Interview questions, Abstraction interview question, Polymorphism interview questions, etc. for better understanding.

by (52.6k points)
...