complete newcomer question (cannot find symbol)

on terminal, I was given 20 error messages...

DemoVariables.java:11: cannot find symbol

symbol : variable sum

location: class DemoVariables

sum = value1 + value2;

^

DemoVariables.java:11: cannot find symbol

symbol : variable value1

location: class DemoVariables

sum = value1 + value2;

^

DemoVariables.java:11: cannot find symbol

symbol : variable value2

location: class DemoVariables

sum = value1 + value2;

^

DemoVariables.java:12: cannot find symbol

symbol : variable difference

location: class DemoVariables

difference = value1 - value2;

^

DemoVariables.java:12: cannot find symbol

symbol : variable value1

location: class DemoVariables

difference = value1 - value2;

^

DemoVariables.java:12: cannot find symbol

symbol : variable value2

location: class DemoVariables

difference = value1 - value2;

^

DemoVariables.java:13: cannot find symbol

symbol : variable product

location: class DemoVariables

product = value1 * value2;

^

DemoVariables.java:13: cannot find symbol

symbol : variable value1

location: class DemoVariables

product = value1 * value2;

^

DemoVariables.java:13: cannot find symbol

symbol : variable value2

location: class DemoVariables

product = value1 * value2;

^

DemoVariables.java:14: cannot find symbol

symbol : variable quotient

location: class DemoVariables

quotient = value1 / value2;

^

DemoVariables.java:14: cannot find symbol

symbol : variable value1

location: class DemoVariables

quotient = value1 / value2;

^

DemoVariables.java:14: cannot find symbol

symbol : variable value2

location: class DemoVariables

quotient = value1 / value2;

^

DemoVariables.java:15: cannot find symbol

symbol : variable modulus

location: class DemoVariables

modulus = value1 % value2;

^

DemoVariables.java:15: cannot find symbol

symbol : variable value1

location: class DemoVariables

modulus = value1 % value2;

^

DemoVariables.java:15: cannot find symbol

symbol : variable value2

location: class DemoVariables

modulus = value1 % value2;

^

DemoVariables.java:16: cannot find symbol

symbol : variable sum

location: class DemoVariables

System.out.println("Sum is " + sum);

^

DemoVariables.java:17: cannot find symbol

symbol : variable difference

location: class DemoVariables

System.out.println("Difference is " + difference);

^

DemoVariables.java:18: cannot find symbol

symbol : variable product

location: class DemoVariables

System.out.println("Product is " + product);

^

DemoVariables.java:19: cannot find symbol

symbol : variable quotient

location: class DemoVariables

System.out.println("Quotient is " + quotient);

^

DemoVariables.java:20: cannot find symbol

symbol : variable modulus

location: class DemoVariables

System.out.println("Modulus is " + modulus);

^

THE SOURCE:

public class DemoVariables

{

public static void main(String[] args)

{

int oneInt = 315;

short oneShort = 23;

long oneLong = 123456789876543L;

System.out.println("The int is " + oneInt);

System.out.println("The short is " + oneInt);

System.out.println("The long is " + oneLong);

sum = value1 + value2;

difference = value1 - value2;

product = value1 * value2;

quotient = value1 / value2;

modulus = value1 % value2;

System.out.println("Sum is " + sum);

System.out.println("Difference is " + difference);

System.out.println("Product is " + product);

System.out.println("Quotient is " + quotient);

System.out.println("Modulus is " + modulus);

int value1 = 43, value2 = 10, sum, difference, product, quotient, modulus;

}

}

Can anyone tell me what I did wrong?

Thanks...

[4209 byte] By [speedingbulleta] at [2007-11-26 15:53:40]
# 1
Never mind, the book didn't specifically say to put the "int value" thing under the long statement.
speedingbulleta at 2007-7-8 22:14:11 > top of Java-index,Developer Tools,Java Compiler...
# 2

Similar problem

This is the objective of my lesson: Develop a class to represents a human. The head, arms and legs should be properties of the human and should be represented by separate objects. All of your objects should have at least three properties and one method.

public class Human

{

Head human_head;

public Human(String color1, String size1, String color2)

{

human_head = new Head(color1, size1, color2);

}

public static void main(String[] args)

{

Human mke = new Human("green", "big", "blonde");

System.out.println("My name is Phil I have " + mke.human_head + "eyes head hair");

}

}

C:\java_code>javac usingobjects\Human.java

usingobjects\Human.java:8: cannot find symbol

symbol : class Head

location: class usingobjects.Human

Head human_head;

^

usingobjects\Human.java:14: cannot find symbol

symbol : class Head

location: class usingobjects.Human

human_head = new Head(color1, size1, color2);

^

2 errors

C:\java_code>

scottmonsta at 2007-7-8 22:14:11 > top of Java-index,Developer Tools,Java Compiler...