220k views
4 votes
What does the following code print?

public class { public static void main(String[] args) // end of main } // end of class.

User Ytw
by
3.7k points

1 Answer

2 votes

Answer:

It throws an error.

the public class needs a name.

like this:

public class G{ public static void main(String[] args)

int x=5 , y = 10;

if (x>5 && y>=2) System.out.println("Class 1");

else if (x<14 // end of main

}

if you give the class a name and format it, you get:

Class 2

Step-by-step explanation:

User Mare
by
3.9k points