Pagina de inicio
/
Tecnología
/
public class Printing public static void main(String[]arg=) System.out.println(" System.out.println () System.out.println () System.out.println(" System.out.println(" ) This won't print anything. square It will only print the first line as hundred square https://www.

Problemas

public class Printing
public static void main(String[]arg=)
System.out.println("
System.out.println ()
System.out.println ()
System.out.println("
System.out.println("
)
This won't print anything.
square 
It will only print the first line as
hundred
square 
https://www.

public class Printing public static void main(String[]arg=) System.out.println(" System.out.println () System.out.println () System.out.println(" System.out.println(" ) This won't print anything. square It will only print the first line as hundred square https://www.

Solución

avatar
Geraldinemaestro · Tutor durante 5 años
expert verifiedVerificación de expertos
4.6 (263 votos)

Responder

The code provided in the question is a Java program that is intended to print several lines of text to the console. However, there are several syntax errors in the code that prevent it from compiling and running correctly.<br /><br />The first issue is that the opening parenthesis for the main method is missing. The main method should be declared as `public static void main(String[] args)`.<br /><br />The second issue is that the closing parenthesis for the main method is missing. The main method should be declared as `public static void main(String[] args)`.<br /><br />The third issue is that the closing parenthesis for the first `System.out.println()` statement is missing. The statement should be `System.out.println("hundred");`.<br /><br />The fourth issue is that the closing parenthesis for the last `System.out.println()` statement is missing. The statement should be `System.out.println();`.<br /><br />Once these issues are corrected, the code will compile and run correctly, and it will print the following output to the console:<br />```<br />hundred<br />```<br />Therefore, the correct answer is that it will only print the first line as "hundred".
Haz clic para calificar: