Type the statements. Then, correct the one syntax error in each statement. Hints
ID: 3882383 • Letter: T
Question
Type the statements. Then, correct the one syntax error in each statement. Hints: Statements end in semicolons, and string literals use double quotes. System.out.printl("Predictions are hard."); System.out.print("Especially '); System.out.println("about the future."). System.out.println("Num is: " - userNum); 1 2 3 4 5 6 7 8 9 10 11 12 import java.util.Scanner; public class Errors { public static void main(String [] args) { int userNum = 5; system.out.println("Predications are hard"); system.out.print("Especially '); system.out.println("about the future"); system.out.println("Num is:" - userNum); return; } } I KEEP GETTING ERRORS
Explanation / Answer
Here you written the print statement syntaxes wrong. The below are the correct statements which are modified.
System.out.print("Predictions are hard.");
System.out.print("Especially") ;
System.out.println("about the future.");
System.out.println("Num is: " +userNum);i
==> import java.util.Scanner;
public class Errors
{
public static void main(String args[] )
{
int userNum = 5;
System.out.println("Predications are hard");
System.out.print("Especially" );
System.out.println("about the future");
System.out.println("Num is:" +userNum);
return;
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.