Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

problem witn code from Head First Java  RSS feed

 
Egor Korenevski
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm beginig with Java. Tried to do the first code from first chapter. After creating of the class Party I used JVM. And got error: main method not found in class party. please define the main method as: public static void main<String[] args> or a JavaFX application class must extend javafx.application.Application
What have I done wrong?

 
wu songsong
Greenhorn
Posts: 1
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Knute Snortum
Sheriff
Posts: 4073
112
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch, wu and Egor!

Egor: Head First Java often leaves out this kind of "boilerplate" code so that the examples are shorter.

wu: Thanks for the solution. Just so you know, we usually don't give complete solutions here, but instead offer advice to help the OP arrive at their own conclusion -- although snippets of code are fine. Also, you should UseCodeTags (that's a link). It makes your code look much better. I'll put them in for you this time.
 
Egor Korenevski
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you.
 
L Foster
Ranch Hand
Posts: 242
14
Android Angular Framework AngularJS Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Egor,
Please checkout the Java Tutorials http://docs.oracle.com/javase/tutorial/ if you get frustrated with "Head First". I have not used Head First, since one early attempt with Java EJBs, but I have frequently found answers for various things in the tutorials.
 
Campbell Ritchie
Marshal
Posts: 55698
163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The two are different. HFJ is a teaching book intended for not‑quite‑beginners. The Java™ Tutorials are probably the most comprehensive such source available. But has quite short examples.

The Party app in the early chapters of HFJ is notorious because it is incomplete and cannot be executed without adding quite a lot of code.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!