• 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

Ran into int cannot be dereferenced

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i ran into int cannot be "dereferenced" when i tried to call scanner and fileread from another method.
so i could use the second method to read from a file and write it to an array...
I had the same issue with the first method as well, ended up making a new scanner and file read inside the Average method
This just doesn't seem right.



 
doug salls
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I know i could just setup another filereader and scanner inside the second method to make that work.. but again..
Just doesn't seem to be the right way to go about it.....
 
Sheriff
Posts: 22785
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In your ArrayFeeder method, the IntAssassin parameter is an int but you treat it as if it were a Scanner. Remember, that IntAssassin is not the same one as in your AVERAGE method.
 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You should seriously look into Java Naming Conventions. The identifiers you are using makes the code hard to read.
 
doug salls
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Christiaan Lombard wrote:You should seriously look into Java Naming Conventions. The identifiers you are using makes the code hard to read.



Will work on that. Had been using it as way for me to get used to classes i am working with.
I'll take 3 seconds to Ctrl+R swap em before i post code again..
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic