aspose file tools*
The moose likes Beginning Java and the fly likes beginner question: cannot find symbol compiler error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "beginner question: cannot find symbol compiler error" Watch "beginner question: cannot find symbol compiler error" New topic
Author

beginner question: cannot find symbol compiler error

Vince Stone
Greenhorn

Joined: Oct 01, 2011
Posts: 7
Hi everyone, I'm new to the forums so please bear with me. I'm working on an assignment for my beginner java class and am having trouble compiling from the get-go. I keep getting a cannot find symbol compiler error when I try to compile my tester. Here's my code:

and here's the error I'm getting when I compile:

2 errors found:
File: /List12Tester.java [line: 15]
Error: /List12Tester.java:15: cannot find symbol
symbol : class List12
location: class List12Tester

File: /List12Tester.java [line: 40]
Error: /List12Tester.java:40: cannot find symbol
symbol : class List12
location: class List12Tester

Any help/advice would be great, I have a feeling there is a really simple and stupid mistake I am making but I'm new to both this community and to the java programming world, so please bear with me. Thanks guys!
Greg Brannon
Bartender

Joined: Oct 24, 2010
Posts: 563
The error statements are pretty helpful. The compiler doesn't know what List12 is. Based on the syntax, the compiler is expecting a class called List12, and it can't find such a class. What is List12? Once you can answer that question, let the compiler know.


Always learning Java, currently using Eclipse on Fedora.
Linux user#: 501795
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11476
    
  16

<jumps up on soapbox>
You should never have gotten this far. NEVER NEVER NEVER write more than 2-3 lines before you compile. Without exception, every time I start a project, I get exactly this far before I compile:

I compile and run that. If i get compiler errors (and sometimes I do), I don't to anything else until they are fixed. I then write another 2-3 lines AT MOST before I compile again.

Writing almost 50 lines before you compile is NOT the way to do it. It's like riding a bike using only one leg and the highest gear ratio. Your making it too hard on yourself.

<jumps off soapbox>


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Unnar Björnsson
Ranch Hand

Joined: Apr 30, 2005
Posts: 164
You're making an object of type List12, but there isn't any class named List12 is there?
Vince Stone
Greenhorn

Joined: Oct 01, 2011
Posts: 7
Thanks for all the responses guys and from now and on I'll always compile right after adding 1-2 lines to my code. I changed the line to because the class is named List12Tester but then I get another error:
File: /List12Tester.java [line: 15]
Error: /List12Tester.java:15: type List12Tester does not take parameters.

Any ideas? Thanks again for all the help and advice!
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4463
    
    8

I have to say, I don't think you understand what you're trying to do. It looks like List12Tester is intended to be a set of unit tests to test a class List12. In other words, you should be creating a List12 - but that class is missing. It looks like instead trying to locate the correct class, you've decided to just instantiate a completely different class instead.

This will become clear as you fix each compiler error:

- Your code now won't compile because List12Tester doesn't take a generic type, but you're providing one (String)
- Fix that, and it will tell you that List12Tester doesn't have a no-arg constructor
- Fix that, and it will complain that you're trying to assign a List12Tester object to a List variable
- Fix that, and it will say there's no add method in the List12Tester class.

I'd recommend you go back and clarify exactly what your code is trying to achieve.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: beginner question: cannot find symbol compiler error