Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.

Slides:



Advertisements
Similar presentations
Air Force Institute of Technology Electrical and Computer Engineering
Advertisements

Chapter 41 Variables and JSP Control Structures JavaServer Pages By Xue Bai.
Written by: Dr. JJ Shepherd
CERTIFICATION OBJECTIVES Use Class Members Develop Wrapper Code & Autoboxing Code Determine the Effects of Passing Variables into Methods Recognize when.
IntroductionIntroduction  Computer program: an ordered sequence of statements whose objective is to accomplish a task.  Programming: process of planning.
George Blank University Lecturer. CS 602 Java and the Web Object Oriented Software Development Using Java Chapter 4.
Road Map Introduction to object oriented programming. Classes
Inheritance and Class Hierarchies Chapter 3. Chapter 3: Inheritance and Class Hierarchies2 Chapter Objectives To understand inheritance and how it facilitates.
Java Programming, 3e Concepts and Techniques Chapter 5 Arrays, Loops, and Layout Managers Using External Classes.
1 Chapter 4 Language Fundamentals. 2 Identifiers Program parts such as packages, classes, and class members have names, which are formally known as identifiers.
OOP in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Terms and Rules Professor Evan Korth New York University (All rights reserved)
Fundamental Programming Structures in Java: Comments, Data Types, Variables, Assignments, Operators.
March 2005Java Programming1. March 2005Java Programming2 Why Java? Platform independence Object Oriented design Run-time checks (fewer bugs) Exception.
Peter Juszczyk CS 492/493 - ISGS. // Is this C# or Java? class TestApp { static void Main() { int counter = 0; counter++; } } The answer is C# - In C#
1 Inheritance and Polymorphism Chapter 9. 2 Polymorphism, Dynamic Binding and Generic Programming public class Test { public static void main(String[]
Introduction to Object Oriented Programming. Object Oriented Programming Technique used to develop programs revolving around the real world entities In.
General Features of Java Programming Language Variables and Data Types Operators Expressions Control Flow Statements.
Java Tutorial. Object-Oriented Programming Concepts Object –a representation of some item state  fields/members and should be encapsulated behavior 
Programming in Java Unit 2. Class and variable declaration A class is best thought of as a template from which objects are created. You can create many.
Operators Using Java operators An operator takes one or more arguments and produces a new value. All operators produce a value from their.
Introduction to Programming David Goldschmidt, Ph.D. Computer Science The College of Saint Rose Java Fundamentals (Comments, Variables, etc.)
2000 Jordan Anastasiade. All rights reserved. 1 Class In this lesson you will be learning about: Class. Inheritance. Polymorphism. Nested and.
The Java Programming Language
1 The Sun’s Java Certification and its Possible Role in the Joint Teaching Material Nataša Ibrajter Faculty of Science Department of Mathematics and Informatics.
JAVA Tokens. Introduction A token is an individual element in a program. More than one token can appear in a single line separated by white spaces.
Hello.java Program Output 1 public class Hello { 2 public static void main( String [] args ) 3 { 4 System.out.println( “Hello!" ); 5 } // end method main.
Java Structure import java_packages; class JavaClass { member variables declarations; void otherMethod( ) { } public static void main(String[]
More on Hierarchies 1. When an object of a subclass is instantiated, is memory allocated for only the data members of the subclass or also for the members.
Page: 1 การโปรแกรมเชิงวัตถุด้วยภาษา JAVA บุรินทร์ รุจจนพันธุ์.. ปรับปรุง 15 มิถุนายน 2552 Keyword & Data Type มหาวิทยาลัยเนชั่น.
C# EMILEE KING. HISTORY OF C# In the late 1990’s Microsoft recognized the need to be able to develop applications that can run on multiple operating system.
Controlling Program Flow. Data Types and Variable Declarations Controlling Program Flow.
Chapter 6 Introduction to Defining Classes. Objectives: Design and implement a simple class from user requirements. Organize a program in terms of a view.
Copyright Curt Hill Variables What are they? Why do we need them?
Chapter 14 Abstract Classes and Interfaces. Abstract Classes An abstract class extracts common features and functionality of a family of objects An abstract.
Java Language Basics By Keywords Keywords of Java are given below – abstract continue for new switch assert *** default goto * package.
CMSC 341 Java Packages, Classes, Variables, Expressions, Flow Control, and Exceptions.
Sections © Copyright by Pearson Education, Inc. All Rights Reserved.
COP3502 Programming Fundamentals for CIS Majors 1 Instructor: Parisa Rashidi.
Operators in JAVA. Operator An operator is a symbol that operates on one or more arguments to produce a result. Java provides a rich set of operators.
Java Nuts and Bolts Variables and Data Types Operators Expressions Control Flow Statements Arrays and Strings.
Chapter 8 Class Inheritance and Interfaces F Superclasses and Subclasses  Keywords: super F Overriding methods  The Object Class  Modifiers: protected,
 In the java programming language, a keyword is one of 50 reserved words which have a predefined meaning in the language; because of this,
Inheritance and Class Hierarchies Chapter 3. Chapter 3: Inheritance and Class Hierarchies2 Chapter Objectives To understand inheritance and how it facilitates.
Inheritance and Class Hierarchies Chapter 3. Chapter Objectives  To understand inheritance and how it facilitates code reuse  To understand how Java.
Classes, Interfaces and Packages
Quick Review of OOP Constructs Classes:  Data types for structured data and behavior  fields and methods Objects:  Variables whose data type is a class.
Chapter 1 Java Programming Review. Introduction Java is platform-independent, meaning that you can write a program once and run it anywhere. Java programs.
© 2006 Pearson Addison-Wesley. All rights reserved 1-1 Chapter 1 Review of Java Fundamentals.
Terms and Rules II Professor Evan Korth New York University (All rights reserved)
Reference Types CSE301 University of Sunderland Harry R Erwin, PhD.
Java Basics. Tokens: 1.Keywords int test12 = 10, i; int TEst12 = 20; Int keyword is used to declare integer variables All Key words are lower case java.
JAVA Programming (Session 2) “When you are willing to make sacrifices for a great cause, you will never be alone.” Instructor: รัฐภูมิ เถื่อนถนอม
 Description of Inheritance  Base Class Object  Subclass, Subtype, and Substitutability  Forms of Inheritance  Modifiers and Inheritance  The Benefits.
UMass Lowell Computer Science Java and Distributed Computing Prof. Karen Daniels Fall, 2000 Lecture 10 Java Fundamentals Objects/ClassesMethods.
 It is a pure oops language and a high level language.  It was developed at sun microsystems by James Gosling.
Information and Computer Sciences University of Hawaii, Manoa
Chapter 4 Assignment Statement
University of Central Florida COP 3330 Object Oriented Programming
Java Primer 1: Types, Classes and Operators
Lecture 2: Data Types, Variables, Operators, and Expressions
University of Central Florida COP 3330 Object Oriented Programming
Chapter 3: Using Methods, Classes, and Objects
Chapter 3 Assignment Statement
Expressions and Control Flow in JavaScript
Starting JavaProgramming
null, true, and false are also reserved.
An overview of Java, Data types and variables
University of Kurdistan
Chap 2. Identifiers, Keywords, and Types
Presentation transcript:

Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide

Copyright © 2003 ProsoftTraining. All rights reserved. Lesson 1: Java Language Fundamentals

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

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

Java Source Files Java package and import statements class

Keywords Creating identifiers

Primitive Data Types Eight types –boolean, char, byte, short, int, long, float, double Literals –Boolean –Character –Integral –Floating-point –String

The Java main Method Must be defined within a class Must be defined as follows Public static void main(String [] args)

Variable Initialization Member variables Method local variables

The Math Class Math class methods

Garbage Collection Frees previously allocated heap space that is no longer needed Helps prevent most memory leaks

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

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

Copyright © 2003 ProsoftTraining. All rights reserved. Lesson 2: Java Modifiers

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

Introduction to Java Modifiers Access modifiers Other modifiers

Classes Abstract classes Final classes

Methods Abstract methods Final methods Native methods Static methods Synchronized methods

Variables Final variables Static variables Transient variables Volatile variables

Static Initializers Free-floating blocks of code that are executed at the time a class is loaded

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

Copyright © 2003 ProsoftTraining. All rights reserved. Lesson 3: Flow Control in Java

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

The while Loop Simplest type of loop Executes a statement or code block continuously until some Boolean expression evaluates as false

The do Loop Special form of the while loop Guaranteed to execute at least once

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

The continue Statement Ends the current iteration of a loop and continues execution at the top of the loop

The break Statement Used to exit a loop prematurely

The if / else Statement Permits execution of a statement or code block only if some Boolean expression is true

The switch Statement Uses an integer value to select between multiple alternative threads of execution

Exceptions Errors Runtime exceptions Checked exceptions

Java Exception Class Hierarchy

Throwing Exceptions throws statement

Catching Exceptions try/catch block Using multiple catch statements Rethrowing exceptions finally block

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

Copyright © 2003 ProsoftTraining. All rights reserved. Lesson 4: Operators and Assignments

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

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

Introduction to Expressions Operators Operator precedence

Unary Operators The increment (++) and decrement (--) operators The plus (+) and minus (-) operators The Boolean complement operator (!) The bitwise inversion operator (~) The cast operator

Arithmetic Operators The multiplication (*) and division (/) operators The modulus operator (%) The addition (+) and subtraction (-) operators

Binary Shift Operators The left-shift operator (<<) The right-shift operator (>>) The unsigned right-shift operator (>>>) The right operand

Comparison Operators The equals method The instanceof operator Bitwise operators The and operator (&) The or operator (|) The exclusive-or operator (^)

Short-Circuit Operators Similar to bitwise operators Only applied to Boolean operands Always generate a Boolean result

Ternary Operator Requires three operands

Assignment Operators Methods and assignments

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

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

Copyright © 2003 ProsoftTraining. All rights reserved. Lesson 5: Object Orientation

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

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

Encapsulation Accessors Mutators Encapsulation

Encapsulation of the Book Class

Abstraction The process of developing classes in terms of their –Interfaces –Functionality Used to manage complexity

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

Constructors Instantiating a class The this keyword Constructors and inheritance The super keyword and constructors

Inner Classes Member inner classes –Member access Static inner classes Method inner classes Anonymous inner classes

Arrays Array declarations Constructing arrays Initializing arrays

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

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

Copyright © 2003 ProsoftTraining. All rights reserved. Lesson 6: Threads

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

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

Creating Threads Extending the Thread class Implementing the Runnable interface

Thread States Setting thread priority Yielding threads The suspended state The sleeping state The blocked state

Live Thread States

Thread Synchronization Controlling the flow of multiple simultaneous threads The synchronized keyword Monitors Synchronized code blocks The wait, notify and notifyAll methods Deadlock

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

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

Copyright © 2003 ProsoftTraining. All rights reserved. Lesson 7: The java.awt Package

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

Layout Managers Flow layout manager Border layout manager Grid layout manager Card layout manager GridBag layout manager

Events Event classes Event listeners Event enabling

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

Copyright © 2003 ProsoftTraining. All rights reserved. Lesson 8: The Collections API

Objective Make appropriate selection of collection classes/interfaces to suit specified behavior requirements

Introduction to Collections Simple collections –Vectors –Hash tables Types of collections –Collection –List –Set –Map

The Collections API Java application programming interface that provides an extensible framework for creating data structures Using the Collections API

Summary Make appropriate selection of collection classes/interfaces to suit specified behavior requirements

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