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

Cannot resolve symbol

 
Maria Garcia
Ranch Hand
Posts: 86
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Why is it giving the following error ?
GCTest.java:7 <identifier> expected
obj = null;
GCTest.java:8 <identifier> expected
obj2 = null;
GCTest.java:7 cannot resolve symbol
symbol: class obj
location: class GCTest
obj = null;
GCTest.java:8 cannot resolve symbol
symbol: class obj
location: class GCTest
obj2 = null;
 
Tom Adams
Ranch Hand
Posts: 56
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I will take a run at this...caveats apply:
the obj & obj2 assignment statements need to be place inside a method (maybe the constructor) or inside an instance initilaization block...
{
obj = null;
obj2 = null;
}
 
Maria Garcia
Ranch Hand
Posts: 86
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm still a bit confused...
 
Dan Culache
Ranch Hand
Posts: 70
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From the Java specification:

A class body may contain declarations of members of the class, that is, fields (�8.3), classes (�8.5), interfaces (�8.5) and methods (�8.4). A class body may also contain instance initializers (�8.6), static initializers (�8.7), and declarations of constructors (�8.8) for the class.

but
obj = null;
obj2 = null;
are not declarations of a field, class, etc. They are assignments. They should be placed within one of the entities in the mentioned list.
Helpful?
 
Maria Garcia
Ranch Hand
Posts: 86
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmmm... thanks! Everything's clear now
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic