Objects and Classes

Definitions

Based on real-world examples
-- objects are made up of many smaller parts, like Legos
Classes
templates for multiple objects with similar features
Tree class (it has leaves and roots and can grow)
You can create instances of a tree with different features
Instance
a specific concrete representation of a class. Equivalent to objects
Instance variables
defines the attributes about the object, ie. the data
the tree has leaves and roots
Methods
functions defined by the object that operate on instances of that object
class Tree {
   Leaf[] leaves;
   Root[] roots;

   void grow() {
      <- Code for growing ->
   }
}

What is Java??

"Java: A simple, object-oriented, distributed, interpreted, robust, secure, architecture neutral, portable, high-performance, multithreaded, and dynamic language." - "The Java Language: A White Paper

 

Java allows the program to be written once and run everywhere.

 

public class HelloWorld {
   public static void main(String[] args) {
      System.out.println("Hello World!");
   }
}

I couldn't resist.


Introduction to the AWT >>