Premium Partner

OCJP 6

Questions to the Certification Oracle Java 6 Programmer based on the study guide

Questions to the Certification Oracle Java 6 Programmer based on the study guide


Kartei Details

Karten 51
Sprache English
Kategorie Informatik
Stufe Universität
Erstellt / Aktualisiert 08.05.2013 / 18.04.2016
Lizenzierung Kein Urheberrechtsschutz (CC0)
Weblink
https://card2brain.ch/box/ocjp_6
Einbinden
<iframe src="https://card2brain.ch/box/ocjp_6/embed" width="780" height="150" scrolling="no" frameborder="0"></iframe>

Class

A template that describes the kinds of state and behavior that objects of its type support

Object

At runtime, when the Java Virtual Machine (JVM) encounters the new keyword, it will use the appropriate class to make an object which is an instance of that class. That object will have its own state, and access to all of

the behaviors defined by its class.

State (instance variables)

Each object (instance of a class) will have its own unique set of instance variables as defined in the class. Collectively, the values assigned to an object's instance variables make up the object's state.

Behavior (methods)

When a programmer creates a class, she creates methods for that class. Methods are where the class' logic is stored. Methods are where the real work gets done. They are where algorithms get executed, and data gets manipulated.

What does it mean to access a class? When we say code from one class (class A) has access to another class (class B), it means class A can do one of three things:

  1. Create an instance of class B.
  2. Extend class B (in other words, become a subclass of class B)
  3. Access certain methods and variables within class B, depending on the access control of those methods and variables

 

-> in effect, access means visibility.

Access to Class Members:

public

  • From the same class
  • from any class in the same package
  • from a subclass in the same package
  • from a scubclass outside the same package
  • from any non-subclass class outside the package

Access to Class Members:

protected

  • from the same class
  • from any class in the same package
  • from a subclass in the same package
  • from a subclass outside the same package (THROUGH INHERITANCE)

Access to Class Members:

default

  • from the same class
  • from any class in the same package
  • from a subclass in the same package