| By Yakov Fain | Article Rating: |
|
| April 13, 2005 12:00 AM EDT | Reads: |
116,327 |
I've been using the Eclipse IDE for creating the Ping-Pong example, but you do not have to use any IDE, and can create these programs using any plain text editor and a standard javac compiler. In this case you'll need to follow the following steps to create these programs in the packages engine and screen.
- Create a directory PingPong
- Create two subdirectories inside called engine and package
- Type and save the file PingPongTable.java in the directory screens
- Type and save the file PingPongEngine in the directory engine
- Get into the PingPong directory and compile both classes:
C:\PingPong>javac screens/PingPongTable.java
C:\PingPong>javac engine/PingPongEngine.java - Now you can run the program as follows:
C:\PingPong>java screens.PingPongTable

Naming Conventions
If you are starting a new project, you need to come up with the directory structures and the names for your packages and these are some considerations to keep in mind:
- Name packages using small letters
- You should try to make your package/class name combination unique. There is a simple rule to achieve this: if you work for a company Best Bananas that has a Web site bestbananas.com, the URL of this Web site is guaranteed to be unique. Use this URL in a reverse order as a prefix to all your packages: com.bestnananas. If the name of your project is Shipping, add this word or abbreviation after this prefix: com.bestbananas.ship. You can further separate classes based on their functioinality, for example:
com.bestbananas.ship.invoicing
com.bestbananas.ship.delivery.Directory structure will look as follows:
com
bestbananas
ship
invoicing
delivery - Think of the future uses of your packages. For example, if the invoicing package may be reused in a different application, do not include there classes that are specific to your Shipping application.
- If you have some useful classes that perform such commonly used functions as date formatting or logging, create separate directory for them like util and log.
Published April 13, 2005 Reads 116,327
Copyright © 2005 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
- Your First Java Program
- Intro to Object-Oriented Programming with Java
- Methods, Constructors, Overloading and Access Levels
- Java Exceptions
- Java Streams Basics
- Reading Data from the Internet
- Java Serialization
- Teaching Kids Programming: Even Younger Kids Can Learn Java
- Java Basics: Introduction to Java Threads, Part 1
- Java Basics: Introduction to Java Threads, Part 2
- SYS-CON Webcast: Eclipse IDE for Students, Useful Eclipse Tips & Tricks
More Stories By Yakov Fain
Yakov Fain is a Managing Director of Farata Systems, consulting, training and product company. He has authored several Java books, dozens of technical articles. SYS-CON Books released his latest co-authored book , Rich Internet Applications with Adobe Flex and Java: Secrets of the Masters in Spring 2007. Sun Microsystems has nominated and awarded Yakov with the title Java Champion. He leads the Princeton Java Users Group. He is an Adobe Certified Flex Instructor. Currently Yakov works on the book for O'Reilly "Enterprise Application Development with Flex". He twits at twitter.com/yfain.
![]() |
Howard N-H 04/13/05 02:53:31 PM EDT | |||
I'm glad you mentioned the use of interfaces as repositories of constants. While it may not be recommended in the strict sense of why interfaces exist, I've used this technique for years on large projects as a good way of organizing and reusing constants. |
||||
![]() |
static imports 04/12/05 06:23:33 AM EDT | |||
So you can use wildcards in the import? Can you use static import for static classes? |
||||
![]() |
Java Basics series 04/12/05 06:12:49 AM EDT | |||
Will the other 10 lessons be on SYS-CON.TV? |
||||
![]() |
Java Live 04/11/05 10:17:40 AM EDT | |||
Is it Yakov Fain who is speaking at the moment? A live Java lesson - cool! |
||||
![]() |
sundeep 04/11/05 06:43:13 AM EDT | |||
I used this lesson in conjunction with the last one, lesson ten on eclipse IDE and it really helped me |
||||
- Kindle 2 vs Nook
- Is Cloud Computing Like Teenage Sex?
- GovIT Expo Highlights Cloud Computing
- Tactical Cloud Computing Panel at 1st Annual GovIT Expo
- Cloud Computing Can Revitalize Your Career as Software Developer
- Ubuntu-based Open Source Linux Mint Tests KDE Version
- Yahoo! SVP Shelton Shugar to Discuss Innovation at Cloud Computing Expo
- Virtualization Journal "Readers' Choice Awards" Voting Is Now Open
- Einstein, Sharks and Clouds: IT Security in the Cloud
- Adobe Flex Developer Earns $100K in New York City
- Virtualization Expo Call for Papers Deadline December 15
- Amazon Web Services Database in the Cloud
- Kindle 2 vs Nook
- Cloud CEOs, CTOs & SVPs to Speak at 4th International Cloud Computing Expo
- Is Cloud Computing Like Teenage Sex?
- 1st Annual GovIT Expo: Letter from the Technical Chair
- Ulitzer News: Search vs New Media
- The Difference Between Web Hosting and Cloud Computing
- Cloud Computing Expo: Exclusive Q&A with Yahoo! SVP Cloud Computing
- Confessions of a Ulitzer Addict
- GovIT Expo Highlights Cloud Computing
- Twitter, Linked In, Ning and Ulitzer: Easy Personal Branding Strategy
- My Thoughts on Ulitzer
- Tactical Cloud Computing Panel at 1st Annual GovIT Expo
- The i-Technology Right Stuff
- Linux.SYS-CON.com Exclusive: Linus Discloses *Real* Fathers of Linux
- After Ubuntu, Windows Looks Increasingly Bad, Increasingly Archaic, Increasingly Unfriendly
- Linus' Top Ten SCO Barbs
- A Closer Look at Damn Small Linux
- Netscape Co-Founder's 12 Reasons for Growth of Open Source
- Introducing "Cooperative Linux" - Linux for Windows, No Less
- *POINT - COUNTERPOINT SPECIAL* What's Wrong with the Open Source Community?
- Where Are RIA Technologies Headed in 2008?
- Linux.SYS-CON.com Exclusive: What Would UserLinux Look Like?
- i-Technology Viewpoint: The New Paradigm of IT Buying
- Is Linux Desktop-Ready Yet...or Not?






























