• 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

Why won't my program compile?

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This program is supposed to read a file of numbers and then report back the highest, lowest, sum, average, and total numbers. However, when I try to compile, this error message appears:

error: cannot find symbol
while(input.hasNextDouble);
^
symbol: variable hasNextDouble
location: variable input of type Scanner

***************************************

Here is my code:
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch.

The error message tells you that class Scanner does not have a variable with the name 'hasNextDouble'. If you look in the API documentation, you'll see that indeed does not have a variable named 'hasNextDouble'. However, it does have a method named 'hasNextDouble'. Probably that's what you wanted to call here:

 
reply
    Bookmark Topic Watch Topic
  • New Topic