• Post Reply Bookmark Topic Watch Topic
  • New Topic

error in IcecreamCounter program  RSS feed

 
Alice Chezhira
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hallo everyone  i need help with my program which is supposed to  read the file icecream.dat  , i have put the .dat  file and textIO file in the same location with the program
C:\Users\user\Documents\NetBeansProjects\IcecreamCounter\src\icecreamcounter
and this is my code


im getting this error when i run the program

Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - Erroneous sym type: icecreamcounter.TextIO.readFile
at icecreamcounter.IcecreamCounter.main(IcecreamCounter.java:14)
C:\Users\user\AppData\Local\NetBeans\Cache\8.1\executor-snippets\run.xml:53: Java returned: 1
BUILD FAILED (total time: 0 seconds)


can you please help me to show where i am getting wrong i 'm a beginner  in java
 
Campbell Ritchie
Marshal
Posts: 56553
172
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

I shall go back and add code tags to your post; you sh‍ould always use the tags. You can see how much better it will look
The exception you are suffering is probably caused by using Eclipse and ignoring its warning not to run the code. Go back to the source code and look for little red marks at the left, and tell us which like the error occurs on. If you hover your mouse on the red mark, you will get a popup box with more details of what the error is.

What is TextIO? It isn't in the java.io package. How do you get an Illegal Argument Exception from it? Why have you not closed the catch with a } before reading the file? Why are you mixing ints and doubles like that. If you have 1000000000 ice‑creams and 999999999 of them are strawberry, when you divide the two ints, what will the percentage of strawberry come out as? Why are you trying to squeeze so much into the main method?

[Edit]I see you are using NetBeans. I didn't know NetBeans allowed you to try uncompilable code, too. But it is the same sort of problem; you need to work out what the compiler error is from the information the IDE gives you. Or stop using an IDE.
 
Carey Brown
Saloon Keeper
Posts: 3323
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your returns on lines 30 & 34 will cause main() to exit.
 
Norm Radder
Rancher
Posts: 2240
28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
returning a value in a void method should be a compiler error.
 
Carey Brown
Saloon Keeper
Posts: 3323
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Norm Radder wrote:returning a value in a void method should be a compiler error.

Good point. Alice, have you tried to compile this?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!