asked 186k views
3 votes
The files provided in the code editor to the right contain syntax and/or logic errors. In each case, determine and fix the problem, remove all syntax and coding errors, and run the program to ensure it works properly.

asked
User Nik
by
7.2k points

1 Answer

3 votes

Question Continuation

public class DebugOne3{

public static void main(String args){

System.out.print1n("Over the river");

System.out.pr1ntln("and through the woods");

system.out.println("to Grandmother's house we go");

}

}

Answer:

Line 2: Invalid Syntax for the main method. The main method takes the form

public static void main (String [] args) { }

or

public static void main (String args []) { }

Line 3: The syntax to print is wrong.

To print on a new line, make use of System.out.println(".."); not System.out.print1n();

Line 4:

To print on a new line, make use of System.out.println(".."); not System.out.pr1ntln();

Line 5:

The case of "system" is wrong.

The correct case is sentence case, "System.out.println" without the quotes

The correct program goes, this:

public class DebugOne3{

public static void main(String [] args){

System.out.println("Over the river");

System.out.println("and through the woods");

System.out.println("to Grandmother's house we go");

}

}

Explanation:

answered
User Rodniko
by
8.7k points

No related questions found