I'm trying to write a java program which takes in input from the command line but for some reason I keep getting this message;
public class Class {
public static void main(String[] args) {
String s = args[0];
}
}
Literally trying to just run the above program for now, and once I can get the input working I can build upon the program to complete my h/w assignment.
I keep getting this message when trying to compile in terminal:
error: Class names, 'test', are only accepted if annotation processing is explicitly requested
Also, this is what I'm writing in terminal javac Filename.java test
sometimes I also use "" so I write javac Filename.java "test"
However, I get the same error. I've found other questions who get the same error but the answer seems to be to add a .java when compiling - but I'm already doing this?
testafter the filename?javacjavac Class.javato compile the file, thenjava Class "test"to run it.Class, it’s just a bad idea.Classthat is imported by default. What you have written should work in this case ... but it is liable to lead to confusion in more complicated code. Besides, calling a classClassis a bit like naming your cat "Cat". )