• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

beginner question: cannot find symbol compiler error

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Bartender
Posts: 563
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
lowercase baba
Posts: 13089
67
Chrome Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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>
 
Ranch Hand
Posts: 164
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Bartender
Posts: 4568
9
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic