Download presentation
Presentation is loading. Please wait.
Published byAmberlynn Benson Modified over 9 years ago
1
Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide
2
Copyright © 2003 ProsoftTraining. All rights reserved. Lesson 1: Java Language Fundamentals
3
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
4
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
5
Java Source Files Java package and import statements class
6
Keywords Creating identifiers
7
Primitive Data Types Eight types –boolean, char, byte, short, int, long, float, double Literals –Boolean –Character –Integral –Floating-point –String
8
The Java main Method Must be defined within a class Must be defined as follows Public static void main(String [] args)
9
Variable Initialization Member variables Method local variables
10
The Math Class Math class methods
11
Garbage Collection Frees previously allocated heap space that is no longer needed Helps prevent most memory leaks
12
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
13
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
14
Copyright © 2003 ProsoftTraining. All rights reserved. Lesson 2: Java Modifiers
15
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
16
Introduction to Java Modifiers Access modifiers Other modifiers
17
Classes Abstract classes Final classes
18
Methods Abstract methods Final methods Native methods Static methods Synchronized methods
19
Variables Final variables Static variables Transient variables Volatile variables
20
Static Initializers Free-floating blocks of code that are executed at the time a class is loaded
21
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
22
Copyright © 2003 ProsoftTraining. All rights reserved. Lesson 3: Flow Control in Java
23
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
24
The while Loop Simplest type of loop Executes a statement or code block continuously until some Boolean expression evaluates as false
25
The do Loop Special form of the while loop Guaranteed to execute at least once
26
The for 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
27
The continue Statement Ends the current iteration of a loop and continues execution at the top of the loop
28
The break Statement Used to exit a loop prematurely
29
The if / else Statement Permits execution of a statement or code block only if some Boolean expression is true
30
The switch Statement Uses an integer value to select between multiple alternative threads of execution
31
Exceptions Errors Runtime exceptions Checked exceptions
32
Java Exception Class Hierarchy
33
Throwing Exceptions throws statement
34
Catching Exceptions try/catch block Using multiple catch statements Rethrowing exceptions finally block
35
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
36
Copyright © 2003 ProsoftTraining. All rights reserved. Lesson 4: Operators and Assignments
37
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
38
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
39
Introduction to Expressions Operators Operator precedence
40
Unary Operators The increment (++) and decrement (--) operators The plus (+) and minus (-) operators The Boolean complement operator (!) The bitwise inversion operator (~) The cast operator
41
Arithmetic Operators The multiplication (*) and division (/) operators The modulus operator (%) The addition (+) and subtraction (-) operators
42
Binary Shift Operators The left-shift operator (<<) The right-shift operator (>>) The unsigned right-shift operator (>>>) The right operand
43
Comparison Operators The equals method The instanceof operator Bitwise operators The and operator (&) The or operator (|) The exclusive-or operator (^)
44
Short-Circuit Operators Similar to bitwise operators Only applied to Boolean operands Always generate a Boolean result
45
Ternary Operator Requires three operands
46
Assignment Operators Methods and assignments
47
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
48
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
49
Copyright © 2003 ProsoftTraining. All rights reserved. Lesson 5: Object Orientation
50
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
51
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
52
Encapsulation Accessors Mutators Encapsulation
53
Encapsulation of the Book Class
54
Abstraction The process of developing classes in terms of their –Interfaces –Functionality Used to manage complexity
55
Method Overloading 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
56
Constructors Instantiating a class The this keyword Constructors and inheritance The super keyword and constructors
57
Inner Classes Member inner classes –Member access Static inner classes Method inner classes Anonymous inner classes
58
Arrays Array declarations Constructing arrays Initializing arrays
59
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
60
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
61
Copyright © 2003 ProsoftTraining. All rights reserved. Lesson 6: Threads
62
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
63
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
64
Creating Threads Extending the Thread class Implementing the Runnable interface
65
Thread States Setting thread priority Yielding threads The suspended state The sleeping state The blocked state
66
Live Thread States
67
Thread Synchronization Controlling the flow of multiple simultaneous threads The synchronized keyword Monitors Synchronized code blocks The wait, notify and notifyAll methods Deadlock
69
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
70
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
71
Copyright © 2003 ProsoftTraining. All rights reserved. Lesson 7: The java.awt Package
72
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
73
Layout Managers Flow layout manager Border layout manager Grid layout manager Card layout manager GridBag layout manager
74
Events Event classes Event listeners Event enabling
75
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
76
Copyright © 2003 ProsoftTraining. All rights reserved. Lesson 8: The Collections API
77
Objective Make appropriate selection of collection classes/interfaces to suit specified behavior requirements
78
Introduction to Collections Simple collections –Vectors –Hash tables Types of collections –Collection –List –Set –Map
79
The Collections API Java application programming interface that provides an extensible framework for creating data structures Using the Collections API
80
Summary Make appropriate selection of collection classes/interfaces to suit specified behavior requirements
81
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
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.