• Post Reply Bookmark Topic Watch Topic
  • New Topic

cannot find symbols  RSS feed

 
Carolin Sha
Ranch Hand
Posts: 68
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am taking an algorithm class and i am having some problems trying to get this program to work, any help would be appreciated. The file name is Graph.java



--------------------Configuration: <Default>--------------------
C:\Users\c\Desktop\Graph.java:33: error: cannot find symbol
k=(ArrayList<Integer>)path.clone();
^
symbol: variable path
location: class Graph
C:\Users\c\Desktop\Graph.java:34: error: cannot find symbol
k.add(i);
^
symbol: variable i
location: class Graph
C:\Users\c\Desktop\Graph.java:35: error: return outside method
return k;
^
C:\Users\c\Desktop\Graph.java:89: error: cannot find symbol
graph g = new graph(a);
^
symbol: class graph
location: class Graph
C:\Users\c\Desktop\Graph.java:89: error: cannot find symbol
graph g = new graph(a);
^
symbol: class graph
location: class Graph
Note: C:\Users\c\Desktop\Graph.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
5 errors

Process completed.



 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66306
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check for wanton semi-colons.
 
Stefan Evans
Bartender
Posts: 1837
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The issue is with your method addToEnd.
(hints from the references to 'k' and 'return outside of method'

That code looks to be a method... It has braces around it. But looks can be deceiving. Wait is that a semicolon at the end of line 31?
Why isn't it complaining about a method with no body then? - ohhhh its abstract.

Looks like you have both declared the method as abstract and tried to define an implementation for it.

Pick one.
 
Paul Clapham
Sheriff
Posts: 22823
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As for the undefined "graph" symbol: you don't declare "graph" anywhere in that code. You DO declare "Graph", in fact it's the name of the class. But that's not the same thing -- capitalization counts in Java.

And you do have a method named "graph", which is terribly confusing. Was that supposed to be the constructor? If so, spell it right ("Graph" not "graph") and don't declare a return type.
 
Carey Brown
Saloon Keeper
Posts: 3311
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Carolin Sha wrote:
C:\Users\c\Desktop\Graph.java:33: error: cannot find symbol
k=(ArrayList<Integer>)path.clone();
^

Look VERY closely at line 29.
 
Carolin Sha
Ranch Hand
Posts: 68
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks guys for all the comments.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!