Retype the statements, correcting the syntax errors. System.out.println(\"Num: \
ID: 3785592 • Letter: R
Question
Retype the statements, correcting the syntax errors. System.out.println("Num: " + songnum); System.out.println(int songNum); System.out.println(songNum " songs"); Challenge 1.9.2: More syntax errors Activity Retype the statements, correcting the syntax errors. System.out.println ("Num t songnum); System. out.println (int songNum); System. out.println songNum Songs 1 import java util Scanner 3 public class Errors 4 public static void main C O args) String int songNum 5; Your solution goes here return 10 11 Run Feedback?
Explanation / Answer
* first statement is :- System.out.println("Num: " + songnum);
it will give an error because songnum is not declared as we have seen that int songNum=5; where n is capital .So it should be like that:- System.out.println("Num: " + songNum);
whose output is: 5
*Second statement is :- System.out.println(int songNum);
it will give an error because we cannot write int songNum between braces. So it should be like that:- System.out.println(songNum);
whose output is: 5
*Third statement is :- System.out.println(songNum " songs");
it will give an error because we cannot write an integer and a string without using + symbol. So it should be like that:- System.out.println(songNum + "songs");
whose output is: 5 songs
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.