Printing only the longest line

Report a typo

Uncomment one specific line of code so that the program prints the longest string. Don't let the content of the messages confuse you. The longest string is determined by the number of characters in the text being printed.

Write a program in Java 17
public class Main {

public static void main(String[] args) {

// System.out.println("Print it!");
// System.out.println("No, print it!");
/* System.out.println("Uncomment this line!");
System.out.println("Please, comment this line..... Wait! Is this the longest string?"); */
// System.out.println("Display this text!");
//// System.out.println("Do not comment it!");
}
}
___

Create a free account to access the full topic