Abstract Methods and Classes
January 31, 2009 · Comments Off
An abstract class is a class that is declared abstract—it may or may not include abstract methods. Abstract classes cannot be instantiated, but they can be subclassed. An abstract method is a method that is declared without an implementation (without braces, and followed by a semicolon), like this: abstract...
Source: SASA JAVA
Writing Final Classes and Methods
January 31, 2009 · Comments Off
You can declare some or all of a class's methods final. You use the final keyword in a method declaration to indicate that the method cannot be overridden by subclasses. The Object class does this—a number of its methods are final. You might wish to make a method final if it has an implementation...
Source: SASA JAVA
Object as a Superclass
January 31, 2009 · Comments Off
The Object class, in the java.lang package, sits at the top of the class hierarchy tree. Every class is a descendant, direct or indirect, of the Object class. Every class you use or write inherits the instance methods of Object. You need not use any of these methods, but, if you choose to do so, you...
Source: SASA JAVA
Keyword super
January 31, 2009 · Comments Off
Accessing Superclass MembersIf your method overrides one of its superclass's methods, you can invoke the overridden method through the use of the keyword super. You can also use super to refer to a hidden field (although hiding fields is discouraged). Consider this class, Superclass: public class Superclass...
Source: SASA JAVA
c and Hiding Methods
January 31, 2009 · Comments Off
Instance MethodsAn instance method in a subclass with the same signature (name, plus the number and the type of its parameters) and return type as an instance method in the superclass overrides the superclass's method. The ability of a subclass to override a method allows a class to inherit from a superclass...
Source: SASA JAVA
Inheritance
January 31, 2009 · Comments Off
Definitions: A class that is derived from another class is called a subclass (also a derived class, extended class, or child class). The class from which the subclass is derived is called a superclass (also a base class or a parent class). Excepting Object, which has no superclass, every class has...
Source: SASA JAVA
Rewriting Interfaces
January 31, 2009 · Comments Off
Consider an interface that you have developed called DoIt: public interface DoIt { void doSomething(int i, double x); int doSomethingElse(String s);}Suppose that, at a later time, you want to add a third method to DoIt, so that the interface now becomes: public interface DoIt { void doSomething(int...
Source: SASA JAVA
Summary of Interfaces
January 31, 2009 · Comments Off
An interface defines a protocol of communication between two objects. An interface declaration contains signatures, but no implementations, for a set of methods, and might also contain constant definitions. A class that implements an interface must implement all the methods declared in the interface. An...
Source: SASA JAVA
Implementing an Interface
January 31, 2009 · Comments Off
A Sample Interface, RelatableConsider an interface that defines how to compare the size of objects. public interface Relatable { // this (object calling isLargerThan) and // other must be instances of the same class // returns 1, 0, -1 if this is greater // than, equal to, or less than...
Source: SASA JAVA
Mac vs PC: Transformers Edition
January 31, 2009 · Comments Off
by Nick Greenlee[watch higher quality version]
[Please visit PinoyMacLovers for the full article]...
Source: PinoyMacLovers


