Aug 28

SCJA: Java Really Basic Stuffs – But you may need to know them for exams like SCJA

SCJA: Syllabus

Floating point types:
Enumerated types in Java:
is a finite set of symbolic literals
is represented as first-class object
are allowed in case statements
the literals may be any valid Java identifier

Java Interface
an interface may NOT contain any concrete method implementations
an interface is NOT a class of any style
an interface is NOT a member of a class
An interface defines a set of abstract methods that may have many implementations.

Class Association, Class Composition, dependency:
Compositions may also have navigation methods, but these methods must NOT pass references to the owned objects. This is usually achieved by passing back a copy of the object rather than the owned object itself.
Composition implies that the owning object controls the life cycle of the owned object
Dependency merely imply that one object uses another object during computations.

disadvantages of proper information hiding?
Access to object attributes incur a runtime penalty.However, the Sun hotspot JVM usually can eliminate the added overhead by "inlining" the methods where they are called.
a mutator method is longer than an assignment operation
it is time consuming to use methods to access object attributes rather than direct access.

program to an interface
References to objects should be declared as interfaces rather than concrete classes
the reference variables to objects that need to be as generic as possible. This is the "program to an interface" principle.

correct representation of an attribute in UML

- attr : intuml

0..1 indicates zero or one multiplicity, which is how you can represent an optional association.

? is NOT a valid multiplicity indicator.
* is an abbreviation for 0..*.
M is NOT a valid multiplicity indicator.
? is NOT a valid multiplicity indicator.
0..* is exactly how to indicate zero or more.

Statement types

Skip to toolbar