DWQA QuestionsCategory: JavaWhat is the output of the following Java program?
Editor Staff asked 9 months ago

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 Answers
Editor Staff answered 9 months ago

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.