Summary OCA Java SE 7 Certificate Guide

-
ISBN-10 1617291048 ISBN-13 9781617291043
345 Flashcards & Notes
5 Students
  • This summary

  • +380.000 other summaries

  • A unique study tool

  • A rehearsal system for this summary

  • Studycoaching with videos

Remember faster, study better. Scientifically proven.

This is the summary of the book "OCA Java SE 7 Certificate Guide". The author(s) of the book is/are Mala Gupta. The ISBN of the book is 9781617291043 or 1617291048. This summary is written by students who study efficient with the Study Tool of Study Smart With Chris.

PREMIUM summaries are quality controlled, selected summaries prepared for you to help you achieve your study goals faster!

Summary - OCA Java SE 7 Certificate Guide

  • 1 Java Basics

  • Waar vind ik de tekst
    waar vind ik de tekst?
  • 1.1 The structure of a Java class and source code file

  • Beschrijf hoe java de relatie definieert tussen een class file en een source file
    Een object X kan gedefineerd zijn als een class X. Deze class moet zich bevinden in de source code van java. De java compiler (javac.exe windows / javac macosx/linux) genereert bytecode voor de java virtual machine en slaat deze op in X.class.



  • A person can be defined as a class Person. This class should reside in a Java source code file (Person.java). Using this Java source code file, the Java compiler (javac.exe on Windows or javac on Mac OS X/Linux/UNIX) generates bytecode (compiled code for the Java Virtual Machine) and stores it in Person.class. The scope of this exam objective is limited to Java classes (class Person) and Java source code files (Person.java).
  • Quick list of the components of a class (the ones that are on this exam):
    • The package statement
    • The import statement
    • Comments
    • Class declarations and definitions
    • Variables
    • Methods
    • Constructors
  • Zijn er ook Java classes die geen onderdeel zijn van een package?



    All Java classes are part of a package.  
  • Wat gebeurt er met classes die niet een package gedefinieerd hebben in de source file?



    A Java class can be explicitly defined in a named package; otherwise it becomes part of a default package.
  • Wat is de naam van het Java default package?



    A Java class can be explicitly defined in a named package; otherwise it becomes part of a default package, which doesn’t have a name. 
  • Wat de enige correcte plaats van een package statement in een java class?



    If a class includes a package statement, it must be the first statement in the class definition.




    The only exception to this rule is the presence of comments. A comment can precede a package statement.  
  • Compileert de volgende code? 






    class Course { } package certification;



    The following code will also fail to compile, because it places the package statement within the class definition: 
  • Compileert de volgende code?



    class Course {

    package com.cert;

    }



    A package statement can’t be placed within the curly braces that mark the start and end of a class definition 
  • Compileert de volgende code?



    package com.cert; package com.exams; class Course { }






    A class can’t define multiple package statements.
  • Voor bijgaande afbeelding is de volgende code aanwezig:



    package university;

    import certification.ExamQuestion;
    class AnnualExam {

    ExamQuestion eq;

    } Wat moet er aan de code veranderd worden als AnnualExam niet meer in het package university zit?



    import certification.ExamQuestion; class AnnualExam { ExamQuestion eq; }
  • Welke smaken comments zijn er en benoem ze.



    Comments come in two flavors: multiline (//) comments and end-of-line (/**/) comments. 



  • Comments can appear at multiple places in a class. A comment can appear before and after a package statement, before and after the class definition, before and within and after a method definition. 
  • Compileert de volgende code?



    class MyClass {

    /* Multi-line comments with special characters &%^*{}|\|:;"' ?/>.<,!@#$%^&*()

    */




    Multiline comments can contain any special characters (including Unicode characters).  



  • "Most of the time, when you see a multiline comment in a Java source code file (.java file), you’ll notice that it uses an asterisk (*) to start the comment in the next line." Waarom is dit?



    it’s done more for aesthetic reasons --




    Multiline comments that start with * on a new line—don’t they look well organized? The usage of *isn’t mandatory; it’s done for aesthetic reasons. 
  • Kunnen end-of-line comments in combinatie worden gebruikt met multi-line-comments?
    Ja



  • public final class Runner extends Person implements Athlete {}

    • Keyword implements together with the name of the interfaces being implemented optional
    • Name of the class compulsory
    • Keyword class compulsory
    • Nonaccess modifier, such as final optional
    • Keyword extends together with the name of the base class optional
    • Class body, marked by the opening and closing curly braces, {} compulsory
    • Access modifier, such as public optional
  • (a) public (b) final (c) class Runner (d) extends Person (e) implements Athlete (f){}
    • a Access modifiers
    • b Nonaccess modifiers
    • c Class name
    • d Name of the base class, if the class is extending another class
    • e All implemented interfaces, if the class is implementing any interfaces
    • f Class body (class fields, methods, constructors), included within a pair of curly braces, {}
  • A class is a design used to specify the properties and behavior of an object. The properties of an object are implemented using variables, and the behavior is implemented using methods.
  • A class is a design from which an object can be created.
  • A class name starts with the keyword class.
    The state of a class is defined using attributes or instance variables.
    The behavior is defined using methods. The methods will include the argumentlist.
  • Kan je een class aanmaken met de naam Class?
    Nee
  • The state of an object is also called an instance.



  • A class constructor is used to create and initialize the objects of a class.  



  • Can a class be defined by multiple constructors that accept different sets of method parameters?
    Ja
  • Wat zijn de eigenschappen van een instance variabele en wat is het bereik hiervan?
    Instance variabelen zijn alleen buiten methoden gedefinieerd maar binnen de class. Als de waarde van een instance variabele van een object wordt veranderd, wordt de waarde van een ander object van dezelfde class niet veranderd.
  • DEFINITION OF INTERFACES IN A JAVA SOURCE CODE FILE
    An interface is a grouping of related methods and constants, but the methods in an interface cannot define any implementation. An interface specifies a contract for the classes to implement. 
  • Mag ik de class een naam Interface geven?
    Nee



  • Met multiple classes in een enkele java file, wat is dan de correcte order voor classes en interfaces?
    The classes and interfaces can be defined in any order of occurrence in a Java source code file. 
  • Wanneer moet de naam van de java file overeen komen met de class of interface in die file?
    Als de accessor public wordt gebruikt.
  • compileert de volgende code?

    file: Multiple.java


    interface Printable {

       //.. we are not detailing this part
    }

    class MyClass {

       //.. we are not detailing this part
    }

    interface Movable {

       //.. we are not detailing this part
    }

    class Car {

       //.. we are not detailing this part
    }
    Ja meerdere classes en interfaces mogen in een enkele java file worden gedefineerd.
  • compileert de volgende code?

    file: Multiple.java


    interface Printable {

       //.. we are not detailing this part
    }

    public class MyClass {

       //.. we are not detailing this part
    }

    public interface Movable {

       //.. we are not detailing this part
    }

    class Car {

       //.. we are not detailing this part
    }
    Nee!



    A source code file can’t define more than one public class or interface 



  • // Contents of Multiple.java

    public interface Printable {

    //.. we are not detailing this part

    }

    interface Movable {

    //.. we are not detailing this part


    a A Java source code file cannot define multiple interfaces.
    b A Java source code file can only define multiple classes.
    c A Java source code file can define multiple interfaces and classes.
    d The previous class will fail to compile.
    c, d



  • // contents of Multiple2.java interface Printable {


    //.. we are not detailing this par

    }

    class MyClass { //.. we are not detailing this part

    }

    interface Movable {

    //.. we are not detailing this part

    }

    public class Car {

    //.. we are not detailing this part

    }

    public interface Multiple2 {}



    a The code fails to compile.
    b The code compiles successfully.
    c Removing the definition of class Car will compile the code.
    d Changing class Car to a non-public class will compile the code.
    e Changing class Multiple2 to a non-public class will compile the code.
    a, c, d
  • Ik wil meerdere java classes definieren in 1 java file maar in verschillende packages, kan dit?
    kan niet
  • Hoe kan ik de import statements in een multiple java classes in 1 java file, beperken tot 1 class?
    Dit kan niet, 


    Classes and interfaces imported using the import statement are available to all the classes and interfaces defined in the same Java source code file. 
  • Als je een import doet zoals 


    import com.manning.*;

    Waar heb je dan access tot?
    classes EN interfaces
Read the full summary
This summary. +380.000 other summaries. A unique study tool. A rehearsal system for this summary. Studycoaching with videos.

Example questions in this summary

Beschrijf hoe java de relatie definieert tussen een class file en een source file
3
Zijn er ook Java classes die geen onderdeel zijn van een package?
3
Wat gebeurt er met classes die niet een package gedefinieerd hebben in de source file?
3
Wat is de naam van het Java default package?
3
Page 1 of 84