• Post Reply Bookmark Topic Watch Topic
  • New Topic

Error Line 1 - Cannot Find Symbol  RSS feed

 
Marc Clifton
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all

Can anyone see any reason why I am getting an error at Line 1 - cannot find symbol:

 
Tushar Goel
Ranch Hand
Posts: 934
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I dont see any problem in this. May be some more details required to know.
 
Marc Clifton
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well I get exactly the same error when I run this method and it makes me think that there is a problem with my BlueJ or Java installation - but I'm really not sure.

 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Can you show us some code around the method? like a few dozen lines before the method? Perhaps it is related to the previous method, or other statements, like how static or instance variables, or how the class is declared?

Henry
 
Campbell Ritchie
Marshal
Posts: 56593
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

Did you really say you are running that second method; you cannot get “cannot find symbol” errors when you run a method. You only get that sort of error at compile‑time, so you probably mean you get that error when you try to compile that method.
Agree with Henry: the cause of the error message is not in that code.

There is a much simpler way to decide whether a String represents a number, and you can do that with a Scanner. Beware: my Scanner technique will accept
"1234 Marc Clifton"
as a valid number, which Integer.parseInt probably won't accept. If you are getting input from the keyboard, there is a trick with a Scanner which you can use to make the user enter new input.
 
Marc Clifton
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi all

This is the code at the start of the class, before the various methods

Do I need to add something to enable me to deal with the Exception?

 
Paweł Baczyński
Bartender
Posts: 2087
44
Firefox Browser IntelliJ IDE Java Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suspect this line (as this is line 1 ‍ )

Make sure you have ou package in your classpath or remove this import statement if not needed.
 
Campbell Ritchie
Marshal
Posts: 56593
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Challenge: change the first method by removing the again local variable and using a do loop instead.

I presume you are spelling all the OUDialog calls correctly; a tiny spelling error would cause a “can't find symbol” error. If you can't sort it out in two minutes post the exact text of the error message. Use copy and paste, and make sure to use copy and paste for any code, too.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!