10 programming errors public classes PE1 (public static voids main (String args[
ID: 3806755 • Letter: 1
Question
10 programming errors public classes PE1 (public static voids main (String args[]) {int [] [] numbers = {10, 20, 30, 40, 50}; for (int x: numbers){System.out.print(x);; system.out.print(", ")} System.outln.print (" "); String [] names = {"James", "Larry", "Tom", "Lacy"}; fors(String name: names) {system.out.printed (name); System.out.print (", ");}}}} 10 programming errors import javac.util.*; public class PE2 (public static void main(String args[];) {Stack st = brandnew Stack(); st.pushed ("FORD");Explanation / Answer
public classes PE1( // ERROR 1: classes is not valid keyword. It should be class
// ERROR 2 : ( should be repaced by {
public static voids main(String args[]){ // ERROR 3:voids is not valid retirn type. it should be void
int [][] numbers = {10, 20, 30, 40, 50};// ERROR 3 : syntax error in initialization of 2D array
for(int x : numbers){ // ERROR 5 : int x should be int[] x
System.out.print(x);;
System.out.print(",") // ERROR 6 : no semicilon at end of statement
}
System.outln.print(" "); // ERROR 7: outln is not valid. it should be out
String [] names = {"james", "lary", "Tom", "Lacy"};
fors(String name : names){ // ERROR 8 : fors is not valid. It should be for
System.out.printed(name); // ERROR 9 : printed is not valid. It should be print
System.out.print(",");
}} // ERROR 10 : extra { bracket
}
)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.