public class Sum {
public static void main(String args[])
{
int x,y,s;
x=Integer.parseInt(args[0]);
y=Integer.parseInt(args[1]);
s=x+y;
System.out.
When you run this from the commandline, you need to pass in your values for x and y:
java Sum 4 5
If you are running this from eclipse, you need to set it up to pass these arguments in every time you hit the green "run" button.
Eclipse command line arguments
If you don't pass anything in, then the array "args" will be empty. Then you try and access the first element in the array, but since it is empty, this throws an ArrayIndexOutOfBoundsException.