File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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.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: 15081

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 8 API documentation
K. Tsang

Joined: Sep 13, 2007
Posts: 3130

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

K. Tsang JavaRanch SCJP5 SCJD OCPJP7 OCPWCD5 OCPBCD5 OCPWSD5 OCMJEA5 part 1 part 2/3
I agree. Here's the link:
subject: Help ! Cannot find symbol error
It's not a secret anymore!