Identifying syntax and logical errors
Hey guys,
I'm new to java and I can't figure out this problem as I can't make JDK work with comand prompt for some reason and when trying to write the java in a web page it won't work.
Can anyone tell me what the three syntax errors and one logical error in the following code is?
public class Add
{
public static void main(String[] args)
{
double weight1 = 85.5
double weight2 = 92.3
double averWeight = weight1 + weight2 / 2;
System.out.println("Average is " + aver);
}
}
Any help would be very much appreciated.
[604 byte] By [
Kaisa] at [2007-11-26 20:43:04]

> Should it be
>
> System.out.println("Average is " + averWeight);
>
> with averWeight instead of just aver?
What do you think? Do you see a variable named 'aver' declared
somewhere? I don't. And the compiler will nag at you for it.
kind regards,
Jos
> Ok. I'm new to Java. Thanks to the both of you for your help.
You're welcome of course; here's a tip: type in these little exercises
and try to compile them; carefully read what the compiler has to say
about the possible errors. Note that the compiler is totally blind to
most "logical errors".
kind regards,
Jos