Programming - 2 - Classes and Objects Flashcards
Description of Java - OO
In OO, code and ata are couple into object classes, with object instances creatin data copies. Most languages are compiled to the assembly language of the underlying processor. JAVA is compiled to an intermediate representation known as bytecode (platform neutral, language of Java Virtual Machine). JVM is compiled for a specific device and can then run any Java code → platform independence. The approach results in relative inefficiency, unsuitable for real-time embedded progams.
Definition of Classes:
Collection of (public) methods and (private) data
Definition of Methods:
Operations that code of other classes can perform to an object instance. Classes are also define data or instance variables that all methods have access to.
Definition of Constructor:
method with class’s name, initialises instnace variables (called whn new object is created)
Definition of Static Methods :
can be called without an object instance
Definition of Method Overloading:
class includes methods with same name but different parameters
Definition of Primitives:
boolean, char, int, float, double.
Wrapper classes: Boolean, Character, Integer, Float