Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam...
-
Upload
amberlynn-benson -
Category
Documents
-
view
215 -
download
0
Transcript of Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam...
![Page 1: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/1.jpg)
Copyright © 2003 ProsoftTraining. All rights reserved.
Sun Certified Java Programmer Exam Preparation Guide
![Page 2: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/2.jpg)
Copyright © 2003 ProsoftTraining. All rights reserved.
Lesson 1:Java Language Fundamentals
![Page 3: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/3.jpg)
Objectives
• Identify correctly constructed source files, package declarations, import statements, class declarations, interface declarations and implementations, method declarations, variable declarations and identifiers
• State the correspondence between index values in the argument array passed to a main method and command-line arguments
• Identify all Java programming language keywords and correctly constructed identifiers
![Page 4: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/4.jpg)
Objectives (cont’d)
• State the effect of using a variable or array element of any kind when no explicit assignment has been made to it
• State the range of all primitive data types• State the behavior that is guaranteed by the
garbage collection system• Write code using methods of the java.lang.Math class
![Page 5: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/5.jpg)
JavaSource Files
• Java package and import statements• class
![Page 6: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/6.jpg)
Keywords
• Creating identifiers
![Page 7: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/7.jpg)
PrimitiveData Types
• Eight types– boolean, char, byte, short, int, long, float, double
• Literals– Boolean– Character– Integral– Floating-point– String
![Page 8: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/8.jpg)
The Javamain Method
• Must be defined within a class• Must be defined as follows
Public static void main(String [] args)
![Page 9: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/9.jpg)
VariableInitialization
• Member variables• Method local variables
![Page 10: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/10.jpg)
TheMath Class
• Math class methods
![Page 11: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/11.jpg)
GarbageCollection
• Frees previously allocated heap space that is no longer needed
• Helps prevent most memory leaks
![Page 12: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/12.jpg)
Summary
Identify correctly constructed source files, package declarations, import statements, class declarations, interface declarations and implementations, method declarations, variable declarations and identifiers
State the correspondence between index values in the argument array passed to a main method and command-line arguments
Identify all Java programming language keywords and correctly constructed identifiers
![Page 13: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/13.jpg)
Summary (cont’d)
State the effect of using a variable or array element of any kind when no explicit assignment has been made to it
State the range of all primitive data types State the behavior that is guaranteed by the
garbage collection system Write code using methods of the java.lang.Math class
![Page 14: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/14.jpg)
Copyright © 2003 ProsoftTraining. All rights reserved.
Lesson 2:Java Modifiers
![Page 15: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/15.jpg)
Objectives
• Declare classes, inner classes, methods, instance variables, static variables, and automatic variables making appropriate use of all permitted modifiers. State the significance of each of these modifiers both singly and in combination, and state the effect of package relationships on declared items qualified by these modifiers
![Page 16: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/16.jpg)
Introductionto Java Modifiers
• Access modifiers• Other modifiers
![Page 17: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/17.jpg)
Classes
• Abstract classes• Final classes
![Page 18: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/18.jpg)
Methods
• Abstract methods• Final methods• Native methods• Static methods• Synchronized methods
![Page 19: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/19.jpg)
Variables
• Final variables• Static variables• Transient variables• Volatile variables
![Page 20: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/20.jpg)
StaticInitializers
• Free-floating blocks of code that are executed at the time a class is loaded
![Page 21: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/21.jpg)
Summary
Declare classes, inner classes, methods, instance variables, static variables, and automatic variables making appropriate use of all permitted modifiers. State the significance of each of these modifiers both singly and in combination, and state the effect of package relationships on declared items qualified by these modifiers
![Page 22: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/22.jpg)
Copyright © 2003 ProsoftTraining. All rights reserved.
Lesson 3:Flow Control
in Java
![Page 23: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/23.jpg)
Objectives
• Write code using if and switch statements• Write code using all forms of loops, and state
the values taken by loop control variables during and after loop execution
• Write code that makes proper use of exceptions and exception handling clauses, and declare methods and overriding methods that throw exceptions
![Page 24: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/24.jpg)
Thewhile Loop
• Simplest type of loop• Executes a statement or code block
continuously until some Boolean expression evaluates as false
![Page 25: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/25.jpg)
Thedo Loop
• Special form of the while loop• Guaranteed to execute at least once
![Page 26: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/26.jpg)
Thefor Loop
• Allows you to initialize a variable and perform some iterative arithmetic on that variable, executing a loop until some Boolean condition evaluates to false
• Comma separators
![Page 27: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/27.jpg)
Thecontinue Statement
• Ends the current iteration of a loop and continues execution at the top of the loop
![Page 28: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/28.jpg)
The breakStatement
• Used to exit a loop prematurely
![Page 29: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/29.jpg)
The if / elseStatement
• Permits execution of a statement or code block only if some Boolean expression is true
![Page 30: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/30.jpg)
The switchStatement
• Uses an integer value to select between multiple alternative threads of execution
![Page 31: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/31.jpg)
Exceptions
• Errors• Runtime exceptions• Checked exceptions
![Page 32: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/32.jpg)
Java ExceptionClass Hierarchy
Throwable
Exception Error
RuntimeException
![Page 33: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/33.jpg)
ThrowingExceptions
• throws statement
![Page 34: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/34.jpg)
CatchingExceptions
• try/catch block• Using multiple catch statements• Rethrowing exceptions• finally block
![Page 35: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/35.jpg)
Summary
Write code using if and switch statements Write code using all forms of loops, and state
the values taken by loop control variables during and after loop execution
Write code that makes proper use of exceptions and exception handling clauses, and declare methods and overriding methods that throw exceptions
![Page 36: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/36.jpg)
Copyright © 2003 ProsoftTraining. All rights reserved.
Lesson 4:Operators
and Assignments
![Page 37: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/37.jpg)
Objectives
• Determine the result of applying any operator, to operands of any type, class, scope or accessibility, or any combination of these
• Determine the result of applying the Boolean equals(Object) method to objects of any combination of the classes java.lang.String, java.lang.Boolean and java.lang.Object
![Page 38: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/38.jpg)
Objectives (cont'd)
• In an expression involving the operators &, |, &&, || and variables of known values, state which operands are evaluated and the value of the expression
• Determine the effect upon objects and primitive values of passing variables into methods and performing assignments or other modifying operations in that method
![Page 39: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/39.jpg)
Introductionto Expressions
• Operators• Operator precedence
![Page 40: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/40.jpg)
UnaryOperators
• The increment (++) and decrement (--) operators
• The plus (+) and minus (-) operators• The Boolean complement operator (!)• The bitwise inversion operator (~)• The cast operator
![Page 41: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/41.jpg)
ArithmeticOperators
• The multiplication (*) and division (/) operators• The modulus operator (%)• The addition (+) and subtraction (-) operators
![Page 42: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/42.jpg)
BinaryShift Operators
• The left-shift operator (<<)• The right-shift operator (>>)• The unsigned right-shift operator (>>>)• The right operand
![Page 43: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/43.jpg)
ComparisonOperators
• The equals method• The instanceof operator• Bitwise operators• The and operator (&)• The or operator (|)• The exclusive-or operator (^)
![Page 44: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/44.jpg)
Short-CircuitOperators
• Similar to bitwise operators• Only applied to Boolean operands• Always generate a Boolean result
![Page 45: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/45.jpg)
TernaryOperator
• Requires three operands
![Page 46: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/46.jpg)
AssignmentOperators
• Methods and assignments
![Page 47: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/47.jpg)
Summary
Determine the result of applying any operator, to operands of any type, class, scope or accessibility, or any combination of these
Determine the result of applying the Boolean equals(Object) method to objects of any combination of the classes java.lang.String, java.lang.Boolean and java.lang.Object
![Page 48: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/48.jpg)
Summary (cont'd)
In an expression involving the operators &, |, &&, || and variables of known values, state which operands are evaluated and the value of the expression
Determine the effect upon objects and primitive values of passing variables into methods and performing assignments or other modifying operations in that method
![Page 49: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/49.jpg)
Copyright © 2003 ProsoftTraining. All rights reserved.
Lesson 5:Object Orientation
![Page 50: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/50.jpg)
Objectives
• State the benefits of encapsulation in object-oriented design, and write code that implements tightly encapsulated classes and the "is a" and "has a" relationships
• Write code to invoke overridden or overloaded methods and parental or overloaded constructors
• Write code to construct instances of any concrete class
![Page 51: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/51.jpg)
Objectives (cont'd)
• State the legal return types for any method given the declarations of all related methods in this or parent classes
• Write code that declares, constructs and initializes arrays of any base type using any of the permitted forms for both declaration and initialization
• For a given class, determine whether a default constructor will be created, and state the prototype of that constructor
![Page 52: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/52.jpg)
Encapsulation
• Accessors• Mutators• Encapsulation
![Page 53: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/53.jpg)
Encapsulationof the Book Class
getTitle
getAuthor
getIS
BN
titleauthor
isbn
![Page 54: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/54.jpg)
Abstraction
• The process of developing classes in terms of their– Interfaces– Functionality
• Used to manage complexity
![Page 55: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/55.jpg)
MethodOverloading and Overriding
• Overloading– Defining several methods with the same
name within a single class• Overriding
– Refining the functionality of a subclass by modifying a class method under certain circumstances
• The super keyword
![Page 56: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/56.jpg)
Constructors
• Instantiating a class• The this keyword• Constructors and inheritance• The super keyword and constructors
![Page 57: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/57.jpg)
InnerClasses
• Member inner classes– Member access
• Static inner classes• Method inner classes• Anonymous inner classes
![Page 58: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/58.jpg)
Arrays
• Array declarations• Constructing arrays• Initializing arrays
![Page 59: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/59.jpg)
Summary
State the benefits of encapsulation in object-oriented design, and write code that implements tightly encapsulated classes and the "is a" and "has a" relationships
Write code to invoke overridden or overloaded methods and parental or overloaded constructors
Write code to construct instances of any concrete class
![Page 60: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/60.jpg)
Summary (cont'd)
State the legal return types for any method given the declarations of all related methods in this or parent classes
Write code that declares, constructs and initializes arrays of any base type using any of the permitted forms for both declaration and initialization
For a given class, determine whether a default constructor will be created, and state the prototype of that constructor
![Page 61: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/61.jpg)
Copyright © 2003 ProsoftTraining. All rights reserved.
Lesson 6:Threads
![Page 62: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/62.jpg)
Objectives
• Write code to define, instantiate and start new threads using both java.lang.Thread and java.lang.Runnable
• Recognize conditions that might prevent a thread from executing
![Page 63: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/63.jpg)
Objectives (cont'd)
• Write code using synchronized, wait, notify and notifyAll to protect against concurrent access problems and to communicate between threads. Define the interaction between threads, and between threads and object locks
• Identify correctly constructed source files, package declarations, import statements, class declarations, interface declarations and implementations, method declarations, variable declarations and identifiers
![Page 64: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/64.jpg)
CreatingThreads
• Extending the Thread class• Implementing the Runnable interface
![Page 65: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/65.jpg)
ThreadStates
• Setting thread priority• Yielding threads• The suspended state• The sleeping state• The blocked state
![Page 66: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/66.jpg)
LiveThread States
Running
Ready
Suspended Sleeping Blocked
![Page 67: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/67.jpg)
ThreadSynchronization
• Controlling the flow of multiple simultaneous threads
• The synchronized keyword• Monitors• Synchronized code blocks• The wait, notify and notifyAll methods• Deadlock
![Page 68: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/68.jpg)
Deadlock
![Page 69: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/69.jpg)
Summary
Write code to define, instantiate and start new threads using both java.lang.Thread and java.lang.Runnable
Recognize conditions that might prevent a thread from executing
![Page 70: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/70.jpg)
Summary (cont'd)
Write code using synchronized, wait, notify and notifyAll to protect against concurrent access problems and to communicate between threads. Define the interaction between threads, and between threads and object locks
Identify correctly constructed source files, package declarations, import statements, class declarations, interface declarations and implementations, method declarations, variable declarations and identifiers
![Page 71: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/71.jpg)
Copyright © 2003 ProsoftTraining. All rights reserved.
Lesson 7:The java.awt Package
![Page 72: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/72.jpg)
Objectives
• Write code using component, container and layout manager classes of the java.awt package to present a GUI with specified appearance and resize behavior, and distinguish the responsibilities of layout managers from those of containers
• Write code to implement listener classes and methods; in listener methods, extract information from the event to determine the affected component, mouse position, nature and time of the event
![Page 73: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/73.jpg)
LayoutManagers
• Flow layout manager• Border layout manager• Grid layout manager• Card layout manager• GridBag layout manager
![Page 74: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/74.jpg)
Events
• Event classes• Event listeners• Event enabling
![Page 75: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/75.jpg)
Summary
Write code using component, container and layout manager classes of the java.awt package to present a GUI with specified appearance and resize behavior, and distinguish the responsibilities of layout managers from those of containers
Write code to implement listener classes and methods; in listener methods, extract information from the event to determine the affected component, mouse position, nature and time of the event
![Page 76: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/76.jpg)
Copyright © 2003 ProsoftTraining. All rights reserved.
Lesson 8:The Collections API
![Page 77: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/77.jpg)
Objective
• Make appropriate selection of collection classes/interfaces to suit specified behavior requirements
![Page 78: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/78.jpg)
Introductionto Collections
• Simple collections– Vectors– Hash tables
• Types of collections– Collection– List– Set– Map
![Page 79: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/79.jpg)
TheCollections API
• Java application programming interface that provides an extensible framework for creating data structures
• Using the Collections API
![Page 80: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/80.jpg)
Summary
Make appropriate selection of collection classes/interfaces to suit specified behavior requirements
![Page 81: Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.](https://reader031.fdocuments.us/reader031/viewer/2022032600/56649dc45503460f94ab743d/html5/thumbnails/81.jpg)
Sun Certified Java Programmer Exam Preparation Guide
Java Language Fundamentals Java Modifiers Flow Control in Java Operators and Assignments Object Orientation Threads The java.awt Package The Collections API