Oracle Certified Associate, Java SE 7 Programmer Study Guide


Oracle Certified Associate, Java SE 7 Programmer Study Guide
eBook: $29.99
Formats: PDF, PacktLib, ePub and Mobi formats
$25.49
save 15%!
Print + free eBook + free PacktLib access to the book: $79.98    Print cover: $49.99
$49.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Overview
Table of Contents
Author
Support
Sample Chapters
  • In-depth understanding of Java through the examination of objects and methods
  • Extensive code examples and figures to illustrate key concepts in Java SE 7 including memory usage
  • Additional coverage of good programming and design practices as they relate to the certification objectives
  • Step-by-step coverage of certification exam topics in a simplified and easy-to-learn manner

Book Details

Language : English
Paperback : 332 pages [ 235mm x 191mm ]
Release Date : August 2012
ISBN : 1849687323
ISBN 13 : 9781849687324
Author(s) : Richard M. Reese
Topics and Technologies : All Books, Enterprise Products and Platforms, Oracle Database, Enterprise, Oracle

Table of Contents

Preface
Chapter 1: Getting Started with Java
Chapter 2: Java Data Types and Their Usage
Chapter 3: Decision Constructs
Chapter 4: Using Arrays and Collections
Chapter 5: Looping Constructs
Chapter 6: Classes, Constructors, and Methods
Chapter 7: Inheritance and Polymorphism
Chapter 8: Handling Exceptions in an Application
Chapter 9: The Java Application
Appendix: Test Your Knowledge – Answers
Index
  • Chapter 1: Getting Started with Java
    • Understanding Java as a technology
      • Object-oriented software development
      • OOP principles
      • Examining the types of Java applications
    • Exploring the structure of a Java console program
      • A simple Java application
        • Package
        • Import
        • The Customer class
        • Instance variables
        • Methods
        • The CustomerDriver class' main method
    • Exploring the structure of a class
      • Classes, interfaces, and objects
        • Classes and objects
        • Constructors
        • Interfaces
      • Methods
        • Method declaration
        • Method signature
        • The main method
      • Access modifiers
      • Documentation
        • Comments
        • Java naming conventions
        • Using Javadocs
    • Investigating the Java application development process
      • Compiling a Java application
      • SDK file structure
      • IDE file structure
      • Developing Java applications without an IDE
      • Java environment
      • Annotations
      • Java class libraries
    • Summary
    • Certification objectives covered
    • Test your knowledge
    • Chapter 2: Java Data Types and Their Usage
      • Understanding how Java handles data
        • Java identifiers, objects, and memory
        • Stack and heap
        • Declaring a variable
        • Primitive data types
        • Wrapper classes and autoboxing
        • Initializing identifiers
        • Java constants, literals, and enumerations
          • Literals
          • Constants
          • The final keyword
          • Enumerations
          • Immutable objects
        • Instance versus static data
        • Scope and lifetime
          • Scoping rules
        • Access modifiers
        • Data summary
      • Building expressions using operands and operators
        • Precedence and associativity
        • Casting
    • Working with characters and strings
      • The String, StringBuffer, and StringBuilder classes
      • Unicode characters
    • The Character class
      • The Character class – methods
    • The String class
      • String comparisons
      • Basic string methods
      • String length
      • Number/string conversions
      • Miscellaneous String methods
    • The StringBuffer and StringBuilder classes
    • Summary
    • Certification objectives covered
    • Test your knowledge
      • Chapter 3: Decision Constructs
        • Flow of control
          • Control statement – an overview
        • Logical expressions
          • Boolean variables
          • The equality operator
          • Relational operators
          • Logical operators
          • Short circuit evaluation
            • Using the && operator
            • Using the || operator
            • Avoiding short circuit evaluation
        • The if statement
          • Nested if statements
          • The else-if variation
          • The if statement – usage issues
            • Misusing the equality operator
            • Using inverse operations
            • Using Boolean variables instead of logical expressions
            • Using true or false in a logical expression
            • The perils of not using the block statement
            • The dangling else problem
        • Conditional operator
        • The switch statement
          • Integer-based switch statements
          • Enumeration-based switch statements
          • String-based switch statements
            • String issues with the switch statement
        • Control structure issues
          • General decision constructs issues
          • Floating point number considerations
            • Special floating point values
            • Comparing floating point numbers
            • Rounding errors
            • The strictfp keyword
          • Comparing objects
          • Three basic coding activities
          • The goto statement
        • Summary
        • Certification objectives covered
        • Test your knowledge
        • Chapter 4: Using Arrays and Collections
          • Arrays
            • One-dimensional arrays
              • The placement of array brackets
              • Initializing arrays
            • Arrays of objects
            • Multidimensional arrays
            • Array techniques
              • Traversing arrays
              • Comparing arrays
              • Copying arrays
              • Passing arrays
              • Using command-line arguments
            • The Arrays class
            • Key points to remember when using arrays
          • Collections
            • Iterators
            • ArrayList
              • Creating ArrayList
              • Adding elements
              • Retrieving elements
              • Traversing a ArrayList object
              • Sorting a ArrayList object
              • Other ArrayList methods
            • Encapsulating collections
          • Summary
          • Certification objectives covered
          • Test your knowledge
          • Chapter 5: Looping Constructs
            • The for statement
              • The comma operator
              • The for statement and scope
              • The for loop variations
            • The for-each statement
              • Using the for-each statement with a list
              • Implementing the Iterator interface
              • The for-each statement – usage issues
                • Null values
                • Variable number of arguments
            • The while statement
            • The do-while statement
            • The break statement
            • The continue statement
            • Nested loops
            • Using labels
            • Infinite loops
            • Timing is everything
            • Pitfalls
            • Summary
            • Certification objectives covered
            • Test your knowledge
            • Chapter 6: Classes, Constructors, and Methods
              • Classes
                • Object creation
                • Memory management
                • Data encapsulation
                • Referencing instance variables
                • Signature
              • Using the this keyword
                • Passing parameters
                  • Variable number of arguments
                • Immutable objects
              • Constructors
                • Default constructors
                • Overloading the constructors
                • Private constructors
                • Constructor issues
                • Java initialization sequence
              • Methods
                • Defining methods
                • Calling methods
                • Overloading methods
                • Accessors/mutators
              • Instance and static class members
              • Summary
              • Certification objectives covered
              • Test your knowledge
              • Chapter 7: Inheritance and Polymorphism
                • Inheritance
                  • Implementing a subclass
                  • Using the protected keyword
                  • Overriding methods
                  • The @Override annotation
                  • Using the final keyword with classes
                  • Abstract methods and classes
                • Polymorphism
                • Managing classes and objects
                  • The super keyword and constructors
                    • Calling a base class constructor
                    • Accessing an overridden method in the base class
                  • Determining the type of an object
                  • The Object class
                  • Casting objects
                  • A review of scope
                • Summary
                • Certification objectives covered
                • Test your knowledge
                • Chapter 8: Handling Exceptions in an Application
                  • Exception types
                  • Exception handling techniques in Java
                    • Stack trace
                    • Using Throwable methods
                  • The traditional try-catch block
                  • Using the try-with-resource block
                  • Catch statement
                    • Order of the catch blocks
                    • Using the | operator in a catch block
                  • The finally block
                  • Nested try-catch blocks
                  • Exception handling guidelines
                    • Repeating code that threw an exception
                    • Not being specific in which exception you are catching
                    • Losing the stack trace
                    • Scoping and block lengths
                    • Throwing a UnsupportedOperationException object
                    • Ignoring exceptions
                    • Handle exceptions as late as you can
                    • Catching too much in a single block
                    • Logging exceptions
                    • Do not use exceptions to control normal logic flow
                    • Do not try to handle unchecked exceptions
                  • Summary
                  • Certification objectives covered
                  • Test your knowledge
                  • Chapter 9: The Java Application
                    • Code organization
                      • Packages
                      • The directory/file organization of packages
                      • The import statement
                        • Avoiding the import statement
                        • Using the import statement
                        • Using the wildcard character
                        • Multiple classes with the same name
                        • The static import statement
                      • Garbage collection
                    • Resource bundles and the Locale class
                      • Using the Locale class
                      • Using resource bundles
                        • Using a property resource bundle
                        • Using the ListResourceBundle class
                    • Using JDBC
                      • Connecting to a database
                        • Loading a suitable driver
                        • Establishing a connection
                      • Creating a SQL statement
                      • Handling the results
                    • Summary
                    • Certification objectives covered
                    • Test your knowledge
                    • Appendix: Test Your Knowledge – Answers
                      • Chapter 1: Getting Started with Java
                      • Chapter 2: Java Data Types and Their Usage
                      • Chapter 3: Decision Constructs
                      • Chapter 4: Using Arrays and Collections
                      • Chapter 5: Looping Constructs
                      • Chapter 6: Classes, Constructors, and Methods
                      • Chapter 7: Inheritance and Polymorphism
                      • Chapter 8: Handling Exceptions in an Application
                      • Chapter 9: The Java Application

                      Richard M. Reese

                      Richard M. Reese holds a Ph.D. in Computer Science from Texas A & M University and is currently an Associate Professor in the Department of Engineering and Physics at Tarleton State University in Stephenville, Texas. In addition to his experience in academia, Richard has over 17 years experience in industry including operating system development at GTE Automatic Electric Labs and at Lockheed Martin in Fort Worth, Texas, where he supervised a tool development group and oversaw various research and development projects. Prior to his industrial experience he served four years in the United States Air Force. Richard has been involved with Java since 1996 and is a certified Java SE 7 Associate Programmer. He has worked as consultant/instructor of software languages in private and public classes providing him with a variety of insight into industry applications. He has published numerous papers and has developed courseware for a variety of topics including advanced Java technologies. He has also written the EJB 3.1 Cookbook and Java 7 New Features Cookbook for Packt Publishing.
                      Sorry, we don't have any reviews for this title yet.

                      Code Downloads

                      Download the code and support files for this book.


                      Submit Errata

                      Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.


                      Errata

                      - 16 submitted: last submission 03 Jun 2014

                      Errata type: Technical | Page number: 300 | Errata date: 30 Oct 2012

                      Under Answers to Chapter 6: The answer for Question 5 should be Option c and d not a and b

                       

                      Errata type: Language | Page number: 11 | Errata date: 28 Dec 2012

                      Currently the page reads as follows:
                      The third principle is polymorphism and its primary concern is to make the application more maintainable and extendable polymorphism behavior is where the behavior of one or identical methods is dependent upon the object it is executing against.

                      It should Be:
                      The third principle is polymorphism and its primary concern is to make the application more maintainable and extendable. Polymorphism behavior is where the behavior of one or identical methods is dependent upon the object it is executing against.

                       

                      Errata type: Layout | Page number: 17 | Errata date: 9 Jan 2012

                      Understanding the application in detail The following sections detail the significant aspects of the example program.

                      Should be

                      Understanding the application in detail

                      The following sections detail the significant aspects of the example program.

                      Errata type: Language | Page number: 251 | Errata date: 9 Jan 2012

                      Java has provided an extensive set of classes to support exception handling in
                      Java.

                      Should be:

                      Java has provided an extensive set of classes to support exception handling.

                      Errata type: Technical | Page number: 275 | Errata date: 9 Jan 2012

                      Currently the page shows as:
                      class Exception A extends Exception {}
                      class Exception B extends A {}
                      class Exception C extends A {}
                      class Exception D extends C {}

                      It should be:

                      class A extends Exception {}
                      class B extends A {}
                      class C extends A {}
                      class D extends C {}

                      Errata type: Code | Page number: 205 | Errata date: 9 Jan 2012

                      Currently it shows as: public Employee getInstance() { Should be:

                      public static Employee getInstance() {

                      Errata type: Technical | Page number: 33 | Errata date: 5 Feb 2013

                       

                      Currently the code is shown as:
                      javac com.company.customer.Customer.java
                      javac com.company.customer.CustomerDriver.java
                      
                      It should be:
                      
                      javac com\company\customer\Customer.java
                      javac com\company\customer\CustomerDriver.java
                      Errata type: Technical | Page number: 297 | Errata date: 5 Feb 2013

                      4. Given the following declaration: StringBuilder sb = new StringBuilder; Which of the following are valid uses of the sb variable? a. sb.append(34.5); b. sb.deleteCharAt(34.5); c. sb.toInteger(3); d. sb.toString(); Answer for this question is given as a,b and d. However, b is incorrect as it passes a double value which deleteCharAt method does not accept. Hence, it is invalid. It should be: Answer to this question should be a and d.
                      Errata type: Technical | Page number: 184 | Errata date: 5 Feb 2013
                      Currently the page is as below:
                      
                      Question is as below:
                      
                      4. Which of the following loops are equivalent?
                      a. for(String n : list) {
                      System.out.println(n);
                      }
                      b. for(int n = 0; n < list.size(); n++ ){
                      System.out.println(list.get(n));
                      }
                      c. Iterator it = list.iterator();
                      while(it.hasNext()) {
                      System.
                      
                      Answer for this is given as :
                      
                      "a, b, c, and d They are all equivalent."
                      
                      
                      It should be:
                      "a, b, and c They are all equivalent."
                       There is no option d in the question.
                      Errata type: Code | Page number: 77 | Errata date: 12 Feb 2013

                      Question 4:

                      StringBuilder sb = new StringBuilder;

                      should be

                      StringBuilder sb = new StringBuilder();

                      The correct answer should be a and d.

                      Errata type: Technical| Page number: 53 | Errata date: 27 Feb 2013

                      3._14_15F is an incorrect example for float literal. It should be
                      3.1_4_15F


                      Errata type: Technical| Page number: 55 | Errata date: 27 Feb 2013

                      In the list of Escape sequences from oracle documentation, \a and \v should be removed.

                      \xhh hexadecimal number should be: \0xhh hexadecimal number

                      Errata type: Technical| Page number: 63 | Errata date: 27 Feb 2013

                      Without the use of the cast operator in such situations, the compiler will issue a warning. The warning is there to suggest that you look more closely at the assignments. The loss of precision may or may not be a problem, depending upon the use of the data within the application. Without a cast operator, an implicit cast is made when the code is executed.

                      Should be:

                      Without the use of the cast operator in such situations, the compiler will issue an error. The error is there to suggest that you look more closely at the assignments. The loss of precision may or may not be a problem, depending upon the use of the data within the application.

                      Errata type: Technical| Page number: 72 | Errata date: 27 Feb 2013

                      charAt: Returns the position of a character given an index in the string.

                      must be :

                      charAt: Returns the char value at the specified index.

                      Errata type: Technical| Page number: 80 | Errata date: 27 Feb 2013

                      hours ==35;

                      Should be

                      hours = 35;

                      Errata type: Layouts| Page number: 106| Errata date: 27 Feb 2013


                      Two floating point types are supported, float and double, with their precisions

                      shown in the following table. In addition, the Integer and Float classes are

                      wrapper classes for these two data types.

                      Should be:

                      Two floating point types are supported, float and double, with their precisions
                      shown in the following table. In addition, the Float and Double classes are
                      wrapper classes for these two data types.

                      Errata type: Technical| Page number: 147| Errata date: 27 Feb 2013

                      The ListIterator method returns a ListIterator object:

                      Should read:

                      The Listiterator method returns a Listiterator object:

                      Errata type: Technical| Page number: 183| Errata date: 27 Feb 2013

                      question 2

                      Given the following declaration of an array, which statement will display

                      each element of the array?

                      int arr[] = {1,2,3,4,5};

                      a. for(int n : arr[]) { System.out.println(n); }

                      b. for(int n : arr) { System.out.println(n); }

                      c. for(int n=1; n < 6; n++) { System.out.println(arr[n]);

                      }

                      d. for(int n=1; n <= 5; n++) { System.out.println(arr[n]);

                      }

                      The correct answer is b.

                      question 4

                      the response is

                      a, b, c, and d They are all equivalent.

                      It should read:

                      a, b and c They are all equivalent.

                      Errata type: Technical| Page number: 226| Errata date: 27 Feb 2013

                      The signature of a class is composed of

                      Should read:

                      The signature of a method is composed of

                       

                       

                      								

                      Errata type: Technical| Page number: 161 | Errata date: 27 Feb 2013

                      The first for loop should be for(int i = 0; i<5; i++) {
                      source[i] = 100;
                      }

                      The sentence:

                      "While we used a for-each to initialize the source array, we can only address a single array at a time."

                      Should be:

                      "In a for-each statement we are only able to address a single element of a single array or collection at a time."

                      Type: Technical | Page number: 300 | Date: 16 JUly 2013

                       

                      In Chapter 7, the answer to The answer to Q.4 should be b and c.

                      Type: Technical | Page number: 54 | Date: 25 July 2013

                      There is a 1 extra in the following code line:

                      value & 0b0000_11111;

                      It should be value & 0b0000_1111;

                      Type: Technical | Page 29

                      "If an object has no references to it, it can be used or accessed even if the  
                      garbage collector has not reclaimed it."
                      The sentence should read "If an object has no references to  
                      it, it can NOT be used or accessed even if the garbage collector has not  
                      reclaimed it."
                      
                      

                      Type: Code | Page: 99

                      pay = 40 * payRate + (hoursWorked - 40) * payRate;

                      Should be:

                      pay = 40 * payRate + (hoursWorked - 40)* 1.5 * payRate;


                      Sample chapters

                      You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

                      Frequently bought together

                      Oracle Certified Associate, Java SE 7 Programmer Study Guide +    IBM Cognos TM1 Cookbook =
                      50% Off
                      the second eBook
                      Price for both: $50.70

                      Buy both these recommended eBooks together and get 50% off the cheapest eBook.

                      What you will learn from this book

                      • Understanding the program structure and the scope and lifetime of variables
                      • Managing the stack and the heap in Java run-time system
                      • Supporting string operations using the StringBuilder class
                      • Using control constructs including if, switch, for and while statements
                      • Declaring and using one and two dimensional arrays
                      • Understanding inheritance and the use of polymorphism including how to overload and override methods
                      • Controlling access to class members using access modifiers
                      • Handling exceptions within a program
                      • Understanding and applying good programming techniques to build your applications

                      In Detail

                      Java SE 7 Associate Programmer certification adds to your qualification as a Java developer. Knowledge of Java is important, but knowing how to write an efficient and productive code adds to your skills and gives you an edge when you are planning to give the certification exam. Coverage of the objectives goes beyond a simple review of certification objectives.

                      "Oracle Certified Associate, Java SE 7 Programmer Study Guide" addresses certification exam objectives and provides discussion and examples to show the best ways of applying Java language features in real world programming. You will gain in-depth understanding of Java by examining how objects are allocated in the heap and how methods are managed in the program stack.

                      "Oracle Certified Associate, Java SE 7 Programmer Study Guide" covers all of the Java SE 7 Associate Programmer certification objectives. It starts with a high level overview of an application’s structure to provide a framework for subsequent chapters. Chapters are organized around common themes with emphasis on memory usage. You will get an in-depth and complete understanding of the run-time Java environment using the illustrations that show the impact of class and method usage on the program stack and heap.

                      Augmenting the coverage of certification objectives are examples of how you can use the classes, methods, and techniques in a productive and sound manner. In addition, sample exam questions are given in each chapter.

                      Approach

                      Each objective is addressed using a series of programming examples. When the topic impacts memory, stack and heap illustrations are used to provide the reader with a more in depth understanding of the topic. At the end of each chapter, a series of sample questions are provided to reinforce your knowledge.

                      Who this book is for

                      This book is designed to help you prepare for the Oracle Certified Associate, Java SE 7 Programmer Certification exam (1Z0-803) and gain confidence in your understanding and use of Java. Basic knowledge of Java programming is expected.

                      Code Download and Errata
                      Packt Anytime, Anywhere
                      Register Books
                      Print Upgrades
                      eBook Downloads
                      Video Support
                      Contact Us
                      Awards Voting Nominations Previous Winners
                      Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
                      Resources
                      Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software