wood burning stoves*
The moose likes Beginning Java and the fly likes Help ! Cannot find symbol error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Help ! Cannot find symbol error" Watch "Help ! Cannot find symbol error" New topic

Help ! Cannot find symbol error

G. Graz
Ranch Hand

Joined: Oct 23, 2006
Posts: 30
I have the following two .class files that I cna not get the "ttest" variable to pass between the two? Very very new to java and I am going crazy this is not working or file 1 will not compile ? HELP!!!

file 1

import java.util.Scanner;
public class Tax
public static void main(String[] args)
Scanner in = new Scanner(System.in);

System.out.print("Please Enter Your Adjusted Gross Income: ");
double agi = in.nextDouble();

double dep = in.nextDouble();

Schedule test = new Schedule (agi,dep,ttst);


File 2

public class Schedule

private static final double sd1 = 5350;
private static final double sd2 = 3400;

public double agi;
public double dep;
public double ttest ;

public Schedule(double aIncome, double aDepi, double aTest )
agi = aIncome;
dep= aDepi;
ttest = aTest;


public double dduct()
double deduct = 0;

if (dep > 0)
deduct = ((agi - sd1)-(dep*sd2));

return deduct;

G. Graz
Ranch Hand

Joined: Oct 23, 2006
Posts: 30
Here is the actual compiler error , sorry !!

java:22: cannot find symbol
symbol : variable ttst
location: class Tax
Schedule test = new Schedule (agi,dep,ttst);
1 error

Tool completed with exit code 1
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074

Well, there is no variable called 'ttst' in your class Schedule. It's called 'ttest'.

"Cannot find symbol" means that you are using a name (of a variable, class etc.) that the compiler doesn't know. Note that the compiler mentions the line number (22) where the error happens, so look at line 22 in your source code.
[ April 20, 2008: Message edited by: Jesper Young ]

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
K. Tsang

Joined: Sep 13, 2007
Posts: 2231

Either missing another nextDouble() or that third parm in Schedule() constructor is dummy variable (useless)

It is sorta covered in the JavaRanch Style Guide.
subject: Help ! Cannot find symbol error
Similar Threads
error "variable not read"
weird hasNextDouble behavior.
Methods and Arrays Help
need help with calculation in my spreadsheet array
Class assignment results not as expected