• Post Reply Bookmark Topic Watch Topic
  • New Topic

Why won't my program compile?  RSS feed

 
David Evangelista
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • 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:
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • 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:

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!