Home IDS 401

Notes Index

Java Notes

Charles E. Oyibo


 

General Notes:

 

7 Strings

Constructing a String

String newString = new String(stringLiteral);

or, in shorthand notation:

String newString = stringLiteral;

8 Inheritance and Polymorphism

 

 

8.6 Polymorphism, Dynamic Binding, and Generic Programming

8.7 Casting objects and the instanceof Operator

8.9 The protected Data and Methods

8.10 The final Classes, Methods, and Variables

8.11 The finalize, clone, and getClass Methods

9 Abstract Classes and Interfaces

9.4 Interfaces

modifier interface InterfaceName
{
  /** Constant declarations */
  /** Method signatures */
}
ComparableRectangle extends Rectangle implements Comparable
{
 ...
}
public class NewClass extends BaseClass 
    implements Interfacei, ..., InterfaceN
{
   ...
}
public interface Edible
{
  public String howToEat();
}
class Animal
{


class Chicken extends Animal implements Edible
{
  public String howToEat()
  {
    return "Fry it";
  }
}
class Fruit implements Edible
{
  public String howToEat()
  {
    return "Eat it fresh";
  }
}


class Apple extends Fruit
{
  public String howToEat()
  {
    return "Make apple cider";
  }
}


class Orange extends Fruit
{
  public String howToEat()
  {
    return "Make orange juice";
  }
}
package java.lang;


public interface Cloneable {
}
Calender calender = new GregorianCalender(2005, 3, 2);
calender calenderCopy = (Calender)calender.clone();

 

 

10 Object-Oriented Modeling

Relationships Among Classes

public class Faculty extends Person {
...
}
public class Student extends Person implements Comparable 
{
  /** Data fields, Constructors, and Methods */



  /** Implement the compareTo method */
  public int compareTo(Object object)
  {
    ...
  }
}

 

 

11 GUI Programming

...

Three basic layout managers:

 

 

Top of Page

Charles E. Oyibo
IDS :: CBA :: UIC