I have started using Java at university; Lecturer cant be found and this is really annoying me.
Code :class SimpleAdd { public static void main(String[] args) { int x; int y; int sum; x = <>; y = <>; sum = x + y; System.out.println(sum); } }
X and Y both need to have values right? So when I enter 1 and 4 like so:
class SimpleAdd {
public static void main(String[] args) {
int x;
int y;
int sum;
x = <int 1>;
y = <int 4>;
sum = x + y;
System.out.println(sum);
}
}
It compiles no problem - but when I ask it to run it tells me:
H:\>cd javame-sdk
H:\javame-sdk>javac SimpleAdd.java
SimpleAdd.java:6: > expected
x = <int 1>;
^
SimpleAdd.java:6: illegal start of expression
x = <int 1>;
^
SimpleAdd.java:6: illegal start of expression
x = <int 1>;
^
SimpleAdd.java:7: > expected
y = <int 4>;
^
SimpleAdd.java:7: illegal start of expression
y = <int 4>;
^
SimpleAdd.java:7: illegal start of expression
y = <int 4>;
^
6 errors
Can anyone help - I know its a basic problem, but without covering the basics how can I progress to more advanced things??
Ben
