• Post Reply Bookmark Topic Watch Topic
  • New Topic

can not be resolve to a type  RSS feed

 
Andrew Concilio
Ranch Hand
Posts: 30
Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello
I have the below code which is a basic java interview question but I am stuck I am getting the below error " person cannot be resolve to a type" what am I doing wrong? and how can I fix it?
Fred Rosenberger a shout out to you or anybody willing to help
Thanks in advance

 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The code uses a class "Person" - you need to have that class around somewhere, but apparently it's not.

By the way, I have added code tags to your post - see how much nicer the code looks? Please do that whenever you post code of any length: UseCodeTags
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66304
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which line?

It's best to exactly cut/paste the error message rather than paraphrasing it.
 
fred rosenberger
lowercase baba
Bartender
Posts: 12562
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you have this:


and then you try and create a "Person" and "Person" array.
 
Andrew Concilio
Ranch Hand
Posts: 30
Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
bear is line 7
Person[] persons = new Person[4];
persons[0] = new Person();

Fred you lost me I am not getting it
 
Paul Clapham
Sheriff
Posts: 22819
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't create an array of "Person" objects unless there's a "Person" class somewhere. And you don't have one. You have a "persons" class, that's true, but "persons" isn't the same as "Person".
 
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!