import java. lang. *;
class demo {
public static void main(String[] args) {
int c= args.length;
for(int i=0;i<c;i );
{
System.out.println([i]);
}
}
}
I need solution for that code . I need explanation for that code. It is showing error cannot find symbol in the part of system.out.println.what is the mistake. Please explain.
CodePudding user response:
Try this :
import java.lang.*;
public class demo {
public static void main(String[] args) {
// print the number of arguments passed in a loop
for (int i = 0; i < args.length; i ) {
System.out.println(args[i]);
}
}
}
Don't forget to pass arguments when you test your program.
CodePudding user response:
you should write this args[i] instead of [i], because java does not know what is [i], but it knows the array; args[] that you are going to pass when you run the application.