View the step-by-step solution to:

Question

SO I NEED TO DECLARE SUM TO BE AN INT, BUT WHEN I DO DECLARE SUM AS AN INT, IT SAYS CANNOT CONVERT BOOLEAN TO INT

HOW IS SUM A BOOLEAN RIGHT NOW NEED EXPLANATION! THANKS!SUMERRRRR.png

SUMERRRRR.png

If C:\Users\Jacks\OneDrive\Desktop\Java\tester1.java
X
File Edit Tools Project Debugger Language Level Help
New
Open
Save
[x Close
$ Cut
[ Copy
Paste
Undo
Redo
86 Find
Compile
Reset
Run
Test
Javadoc
testerl . java
tester2. java
import java. util. Scanner;
import java. io. *
public class testerli
public static void main (String[ ]args) throws 10Exceptionf
File data= new File ("totoallsll. txt") ;
Scanner all= new Scanner (data) ;
int average;
int total;
int totnum= 0;
while (all . hasNextInt( ) ) {
totnum#+ ;
sum=all . hasNextInt () ;
total=sum+sum;
average=total/totnum;
System. out. println("The Average is: *d" , average) ;
Interactions Console | Compiler Output
Compiler
X
* ** Errors ***
Eclipse Compiler 0.A48
File: C:\Users\Jacks\OneDrive\Desktop\Java\testerl. java [line: 13]
Error: sum cannot be resolved to a variable
Highlight source
Editing C:\Users\Jacks\OneDrive\Desktop\Java\tester1.java
13:4
O Type here to search
4:52 PM
10/2/2019

Top Answer

Sign up to view the full answer

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question