19  previous  | toc  | next 
A first look at Object

Programming in the large
  • Object-oriented
    • everything is an instance of something (java.lang.Object)
    • class as an abstraction mechanism
    • objects are defined to model the data and packaged with the methods used to act upon them (constructor, accessor, mutator, and helper)
  • Class Hierarchies
    java.lang.Object
      |
      +--java.awt.Component
            |
            +--java.awt.Container
      
    
  • Java Modifiers
    • Field
      • access modifers
        public
        accessed from anywhere the class that contains it
        protected
        accessed only from within its class, classes in the same package as its class, and subclasses of its class
        private
        accessed only from within its class
        default (no access specifier)
        accessed only from within its class and classes in the same package as its class
      • existence modifiers
        static
        one exists for the entire class, rather than one for each object of its class
      • usage modifiers
        final
        cannot be changed (i.e., constant or read-only)
    • Method
      • access modifers
        public
        accessed from anywhere the class that contains it
        protected
        accessed only from within its class, classes in the same package as its class, and subclasses of its class
        private
        accessed only from within its class
        default (no access specifier)
        accessed only from within its class and classes in the same package as its class
      • existence modifiers
        static
        exists to serve its class, not to serve individual objects of its class; as a consequence, static methods do not have access to instance variables, as instance variables belong to the individual objects; as a further consequence, static methods do not have access to this and super.
      • usage modifiers
        final
        cannot be overriden
        abstract
        must be overriden to be useful
    • Class
      • access modifers
        public
        accessed from within any class
        default (no access specifier)
        accessed from within any class in the same package
      • usage modifiers
        final
        cannot be extended (inherited)
        abstract
        must be extended (inherited) to be useful
  • Inheritance (extends and implements)
  • Polymorphism (overloading and overriding)

 19  previous  | toc  | next