Programacion java
The Programmer’s Exam
CHAPTERS
1 2 3 4 5 Language Fundamentals Declarations and Access Control Operators and Assignments Flow Control, Exceptions, and Assertions Object Orientation, Overloading and Overriding, Constructors, and Return Types 7 8 9 6 Java.lang—The Math Class, Strings, and Wrappers Objects and Collections Inner Classes Threads
1
Language Fundamentals
CERTIFICATIONOBJECTIVES
• • • •
Java Programming Language Keywords Literals and Ranges of All Primitive Data Types Array Declaration, Construction, and Initialization Using a Variable or Array Element That Is Uninitialized and Unassigned Command-Line Arguments to Main Two-Minute Drill
✓
•
Q&A Self Test
4
Chapter 1: Language Fundamentals
his chapter looks at the Java fundamentals thatyou need to pass the Java 1.4 Programmer exam. Because you’re planning on becoming Sun certified, we assume you already know the basics of Java, so this chapter concentrates just on the details you’ll need for the exam. If you’re completely new to Java, this chapter (and the rest of the book) will be confusing, despite our spectacularly cogent writing. That’s our story and we’re sticking to it!T
CERTIFICATION OBJECTIVE
Java Programming Language Keywords (Exam Objective 4.4)
Identify all Java programming language keywords and correctly constructed identifiers. Keywords are special reserved words in Java that you cannot use as identifiers (names) for classes, methods, or variables. They have meaning to the compiler; it uses them to figure out what your source code is trying to do.Table 1-1 contains all 49 of the reserved keywords. You must memorize these for the test; you can count on being asked to select the keywords (and nonkeywords) from a list. Notice none of the reserved words have
TABLE 1-1
Complete List of Java Keywords
abstract char double for int private strictfp throws assert
boolean class else goto interface protected super transient
break constextends if long public switch try
byte continue final implements native return synchronized void
case default finally import new short this volatile
catch do float instanceof package static throw while
Java Programming Language Keywords (Exam Objective 4.4)
5
capital letters; this is a good first step when weeding out nonkeywords on the exam. You’re probably familiar with most ofthem, but we’ll review them anyway. Don’t worry right now about what each keyword means or does; we’ll cover most of them in more detail in later chapters.
Look for questions that include reserved words from languages other than Java. You might see include, overload, unsigned, virtual, friend, and the like. Besides appearing in questions specifically asking for keyword identification, the“imposter” words may show up in code examples used anywhere in the exam. Repeat after me, “Java is not C++.”
Access Modifiers
The following are access modifiers:
■ private
Makes a method or a variable accessible only from within its
own class.
■ protected ■ public
Makes a method or a variable accessible only to classes in the same package or subclasses of the class. Makes a class, method,or variable accessible from any other class.
Class, Method, and Variable Modifiers
The following are class, method, and/or variable modifiers:
■ abstract ■ class ■ final
Used to declare a class that cannot be instantiated, or a method that must be implemented by a nonabstract subclass. Keyword used to specify a class. Used to indicate the superclass that a subclass is extending.
■extends
Makes it impossible to extend a class, override a method, or reinitialize a variable. Used to indicate the interfaces that a class will implement. Keyword used to specify an interface.
■ implements ■ interface ■ native
Indicates a method is written in a platform-dependent language,
such as C.
■ new
Used to instantiate an object by invoking the constructor.
6
Chapter 1:...
Regístrate para leer el documento completo.