• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Object not recognised?

 
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Hi guys.

I have included my code above. I have a buffered reader, which I am attempting to use to read textfiles. The idea being, is that different values will be parsed via persistence, and I have groups/objects, City and YearData with City and YearDate possessing different characteristics. However,    



is not working, it says:

"Cannot find symbol"

Which is majorly confusing me because the City object seems to be instantiated and recognised correctly...?
 
Bartender
Posts: 1251
87
Hibernate jQuery Spring MySQL Database Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Java is case sensitive. See line 59 It's YearData yeardata small 'd' and on line 63 you have repository.add(yearData); capital 'D'
 
tony narloch
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have amended it, thank you. Unfortunately, I have a new error.

"YearData cannot be converted to City"

Now I am assuming (probably wrongly) that I have coded in such a way that I am trying to include YearData in the City object.

My work is based off the following sample code:

static final char DELIMITER=',';  

 

And the crucial differences there that strike me are that, there is the inclusion of an iterator (the for loop) and also, that there is only one invokation of the add method, specifically:



I also note that the above code, uses 0,1,2 and then starts at 0 again for adding to the array string which to me, suggests that we adding data to a different part of the array?
 
Marshal
Posts: 4501
572
VSCode Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

tony narloch wrote:I have a new error. .. "YearData cannot be converted to City"


Maybe I am missing it somehow, but I don't see any reference to YearData or City in the code that you have posted.
 
Sheriff
Posts: 7125
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's in the first posting that those variables appear.
 
Knute Snortum
Sheriff
Posts: 7125
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm just guessing, but maybe Repository#add() starts like this:
If that's so, then you can only add a Customer or one of its subtypes to the repository.  I'm guessing that the class City is not a subtype of Customer.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic