Note
Safari Books Online is an on-demand digital library that delivers expert content in both book and video form from the worlds leading authors in technology and business.
Technology professionals, software developers, web designers, and business and creative professionals use Safari Books Online as their primary resource for research, problem solving, learning, and certification training.
Safari Books Online offers a range of product mixes and pricing programs for organizations, government agencies, and individuals. Subscribers have access to thousands of books, training videos, and prepublication manuscripts in one fully searchable database from publishers like OReilly Media, Prentice Hall Professional, Addison-Wesley Professional, Microsoft Press, Sams, Que, Peachpit Press, Focal Press, Cisco Press, John Wiley & Sons, Syngress, Morgan Kaufmann, IBM Redbooks, Packt, Adobe Press, FT Press, Apress, Manning, New Riders, McGraw-Hill, Jones & Bartlett, Course Technology, and dozens more. For more information about Safari Books Online, please visit us online.
How to Contact Us
Please address comments and questions concerning this book to the publisher:
OReilly Media, Inc. |
1005 Gravenstein Highway North |
Sebastopol, CA 95472 |
800-998-9938 (in the United States or Canada) |
707-829-0515 (international or local) |
707-829-0104 (fax) |
We have a web page for this book, where we list errata, examples, and any additional information. You can access this page at http://oreil.ly/java-8-pocket-guide.
To comment or ask technical questions about this book, send email to .
For more information about our books, courses, conferences, and news, see our website at http://www.oreilly.com.
Find us on Facebook: http://facebook.com/oreilly
Follow us on Twitter: http://twitter.com/oreillymedia
Watch us on YouTube: http://www.youtube.com/oreillymedia
Authors
Robert James Liguori is the principal for Gliesian LLC. He is an Oracle Certified Expert, supporting several Java-based air traffic management and safety applications. Patricia Liguori is a multi-disciplinary information systems engineer for The MITRE Corporation. She has been developing real-time air traffic management systems and aviation-related information systems since 1994.
Acknowledgments
We extend a special thank you to our editor, Meghan Blanchette. Her oversight and collaboration has been invaluable to this endeavor.
Further appreciation goes out to Michael Loukides (technical editor of the initial Java Pocket Guide ), our technical reviewer Ryan Cuprak, as well as the various members of the OReilly team, our family, and our friends.
We would also like to thank again all of those who participated with the original Java Pocket Guide and the Java 7 Pocket Guide .
Most importantly, we thank you for using the book as a reference guide and for loving Java. Feel free to post a picture of yourself with the book on Tumblr. It would be nice to see who is using the book and where it has been (even on vacations). :)
Part I. Language
Chapter 1. Naming Conventions
Naming conventions are used to make Java programs more readable. It is important to use meaningful and unambiguous names comprised of Java letters.
Class Names
Class names should be nouns, as they represent things or objects. They should be mixed case (camel case) with only the first letter of each word capitalized, as in the following:
public
class
Fish
{...}
Interface Names
Interface names should be adjectives. They should end with able or ible whenever the interface provides a capability; otherwise, they should be nouns. Interface names follow the same capitalization convention as class names:
public
interface
Serializable
{...}
public
interface
SystemPanel
{...}
Method Names
Method names should contain a verb, as they are used to make an object take action. They should be mixed case, beginning with a lowercase letter, and the first letter of each subsequent word should be capitalized. Adjectives and nouns may be included in method names:
public
void
locate
()
{...}
// verb
public
String
getWayPoint
()
{...}
// verb and noun
Instance and Static Variable Names
Instance and static variable names should be nouns and should follow the same capitalization convention as method names:
private
String
wayPoint
;
Parameter and Local Variable Names
Parameter and local variable names should be descriptive lowercase single words, acronyms, or abbreviations. If multiple words are necessary, they should follow the same capitalization convention as method names: