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

Studying from Head First Java (2nd Ed.)

 
Bryce Monaco
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I have literally just started reading the book, and I am stuck at the first lesson. The lesson has you create a small applet (if that's the right term) that acts as a party invitation. The problem that I am having is that the compiler is returning 'Symbol Not Found Error' on things such as capital letters, and even periods.

My code (copied directly from the book, line for line)


And the compiling error

If someone could explain what is happening (with some detail, I'm a beginner remember ;) ) and what I could do to fix it, I would greatly appreciate it.
 
Rameshwar Soni
Ranch Hand
Posts: 247
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bryce, Welcome to Ranch

You have imported the packages incorrectly. It should have been



As you can see the * which means you are importing all the classes from the awt and event package.

If you need to import only a single class from a package then it would be written like this



Here only the Frame class would be imported from awt package
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

Beware of the Party example from HFJ; it is incomplete and cannot be executed in its current form. It is usually considered better form to list all the classes you are importing, even if you have several lines starting
import foo.bar.…
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic