I just started using eclipse and java, and I'm not used to any of them. I wrote a simple helloworld program, but the next task (school) was to create a program that accepts userinput (from the command line) and responds with the largest number of two. The code I wrote is as follows:
public class Larger {
public static void main(String[] args) {
if(args.length < 2)
{
System.out.print("Too few parameters submitted.");
return;
}
int num1 = Integer.parseInt(args[0]);
int num2 = Integer.parseInt(args[1]);
System.out.print(Math.max(num1, num2));
}
}
Everything works well when I click the run button in eclipse, but later, when I look at the source files and run "java Larger.class 2 4", I get an error message from java.exe saying that the class was not found.
Any idea what this could be?
source
share