• 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
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

Head First Java - Chapter 11 - MiniMusicCmdLine Error

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I was trying to execute the program on Pg 346 from Head First Java, MiniMusicCmdLine but the below error message displayed. I have gone through the progream multiple times but could not located what is causing this error.


C:\Library\Headache\Pro\Player>javac MiniMusicCmdLine.java
MiniMusicCmdLine.java:45: class, interface, or enum expected
}→
^
1 error



 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Apart from the fact that there some unknown methods in your cord (e.g. ParseInt), it seems that there is a strange character at the end of your file. Maybe you copy/pasted the code and it left some strange characters ? Remove the last line, and retype "}".
 
Sudheer Kolanu
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have typed in everything. I just noticed that there was an extrac closing curly brace at the last which was not posted in this thread which I removed now but getting differnt error now.


C:\Library\Headache\Pro\Player>javac MiniMusicCmdLine.java
MiniMusicCmdLine.java:8: cannot find symbol
symbol : method ParseInt(java.lang.String)
location: class java.lang.Integer
int instrument = Integer.ParseInt(args[0]);
^
1 error

 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sudheer Kolanu wrote:I have typed in everything. I just noticed that there was an extrac closing curly brace at the last which was not posted in this thread


Thanks for that...

but getting differnt error now.


That's the error I was talking about. Check the name of your method (tip: Java is case-sensitive)
 
Sudheer Kolanu
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you, it worked.
 
Marshal
Posts: 76462
366
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sudheer Kolanu wrote:I have typed in everything. . . .

You shouldn't type anything. You should copy-and-paste, then you are sure you are posting real code.
 
Let me tell you a story about a man named Jed. He made this tiny ad:
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic