Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting error as "cannot be resolved to a type"

 
Prince khurana
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Getting error: Encode cannot be resolved to a type on Line no. 25

where am I doing wrong ?


Here is my code:
 
Maneesh Godbole
Saloon Keeper
Posts: 11085
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You forgot to import the Encode class or the package containing it
 
Matthew Brown
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've fixed the indentation, which was inconsistent, and doing that makes it clearer what the problem is.

I think you probably intended the Encode class to be an inner class of Hashnain. But you've actually made is an inner class of Image. So on line 25 there's no available class called Encode.

On a similar matter - you really ought to be consistent in your use of braces {..}. You can have the opening brace on the same line as the previous statement or on it's own line, but for the sake of anyone who has to read your code, don't mix and match!
 
Maneesh Godbole
Saloon Keeper
Posts: 11085
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah. My bad. Encode is an inner class. Didn't notice it. Thanks for the indentation Matthew.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic