Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Head First Java Chapter 11, example on page 346

 
Mark Nibert
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The issue I am having is where it says MidiEvent = null; I am not sure what is going on but it keeps failing the argument if statement. I also dont see where it is prompting for the user cmd line input. Here is the code:

 
Rob Spoor
Sheriff
Pie
Posts: 20511
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please Use Code Tags. You can edit your post to add them.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It doesn't prompt for input, it gets the arguments from the command line.

it keeps failing the argument if statement.

I'm not sure what that means.
 
Mark Nibert
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I run it just processes this line System.out.println("Don't forget the instrument and note args");
I am not sure how to get the information in to the program from the command line. I am still pretty new to this and I cant figure it out.
 
Nitish Bangera
Ranch Hand
Posts: 537
Eclipse IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I hope you are using the cmd for this.

Now while you give java MiniMiniMusicCmdLine 1 2. any integer should be specified as it takes the input from the command line.

If you want to take the input in the program it self then i guess you can use scanner and console.
 
Mark Nibert
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is that where I am screwing up? I am using eclipse for coding it. I will read through the tutorial and run it from the command line tonight. I swear sometimes my brain doesnt function properly.
 
Nitish Bangera
Ranch Hand
Posts: 537
Eclipse IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well i for starters i don't prefer using an IDE. You better use notepad or Textpad(can compile and execute from inside also) and compile and execute using the command line only. Also if you are using eclipse, find out where can you pass in the parameters. Every IDE has that option where you can specify the command line parameters which needs to be passed.
 
Mark Nibert
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are there any good websites w/ labs that I can work through to help enforce the theories and ideas. I have taken programming classes and I am working on an idea for a program to write that I can use as a demo and to hopefully learn some of the more advanced ideas. I wish I would have kept the ones from college.
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nitish Bangera wrote:Well i for starters i don't prefer using an IDE. You better use notepad or Textpad . . .
Agree. But NotePad is pretty bad for programming. Download NotePad2 or NotePad++ which despite the names are quite different from NotePad.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic