Please enable JavaScript.
Coggle requires JavaScript to display documents.
Java - Coggle Diagram
Java
Lecture 2
Object classes
-
-
-
Once declared, classes are treated as a new data type
-
-
-
-
-
-
-
-
Printing to Screen
-
The print method is similar to the println method, except that it does not advance to the next line
-
Java Errors
-
run-time
occur during program execution, such as trying to divide by zero, which causes a program to terminate abnormally
logical error
run, but produce incorrect results,
-
Object class instances
the class is treated just like a basic data
type (i.e. similar to int, char, float etc)
-
-
Dot operator
To access an object’s fields and methods outside of the class,
this
Within an instance method or a constructor, this is a reference to the current object
-
Access specifiers
Unlike C++, access specifiers in Java are on a per-line basis
Java packages
To ‘group’ related content together to ensure consistent naming, avoid name conflicts, control access, make searching/locating classes easier.
Code can be written in several files and grouped together with the statement above (i.e. similar to header declaration)
package pkgname;
-
-
Static
-
Static methods are methods that exist outside the class and uses no instance variables (i.e. don’t
‘belong’ to a class even though declared within)
-
-
-
-
-
-
-
-
-
-
Lecture 1
-
-
-
-
-
-
Abstract classes
-
-
-
If a superclass has an abstract operation, then its subclasses at some level must have a concrete method for the operation
Overriding
A public method would normally be inherited, but with overriding the subclass contains a new version instead
-
-
Access control
-
protected
•Only code in the package, or subclasses can access
-
-