Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

beginner question: cannot find symbol compiler error

 
Vince Stone
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 563
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
fred rosenberger
lowercase baba
Bartender
Pie
Posts: 12022
25
Chrome Java Linux
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<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>
 
Unnar Björnsson
Ranch Hand
Posts: 164
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're making an object of type List12, but there isn't any class named List12 is there?
 
Vince Stone
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4549
8
Java Netbeans IDE Scala
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic