aspose file tools*
The moose likes Beginning Java and the fly likes Help With Classes Needed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Help With Classes Needed" Watch "Help With Classes Needed" New topic
Author

Help With Classes Needed

Andrew Hocker
Greenhorn

Joined: Feb 05, 2004
Posts: 13
Currently in my Java class we are working with semi-advanced types of classes, of which I can't seem to understand. I was wondering if someone could point out to me a resource for the following items, preferably with analogy-like explanations. Any help that can be provided that doesn't include references, is welcome too.
  • abstract class
  • abstract method
  • class (static) method
  • class (static) variable
  • concrete classes
  • final method
  • inheritance
  • interface
  • overriding
  • postcondition
  • precondition


  • I don't really know anything, google does though.
    Ashok C. Mohan
    Ranch Hand

    Joined: Dec 03, 2003
    Posts: 75
    I think you should try Thinking in Java by Bruce Eckel
    Bruce Eckel
    It has detailed explanation on all the topics(BTW the book is available for free download )


    SCJP 1.4
    Do not dwell in the past, do not dream of the future, concentrate the mind on the present moment.
    Dirk Schreckmann
    Sheriff

    Joined: Dec 10, 2001
    Posts: 7023
    First of all, here is a list of free on-line Java tutorials and books that I have found useful:
  • Sun's Java Tutorial
  • Introduction to Computer Science using Java by Bradley Kjell
  • Introduction to Programming Using Java by David J. Eck
  • Dick Baldwin's Java Programming Tutorials
  • Interactive Programming In Java by Lynn Andrea Stein
  • Bruce Eckel's Thinking In Java
  • JavaRanch's own Campfire Stories
  • Allen B. Downey's How To Think Like A Computer Scientist

  • Now, some quick examples of your topics.
    abstract class - a class declared to be abstract
    Note that such a class cannot be direction instantiated with the new operator.

    abstract method - a method without an implementation
    Such a method can only be declared in an abstract class or in an interface. Non-abstract subclasses or classes that implement the interface must provide an implementation of the declared abstract method.

    Note that the method in the interface did not need to be labeled abstract. All methods declared in an interface are implicitly abstract.
    Also note that all methods declared in an interface are implicitly public, even if not explicitly declared to be so. As such, the implementing class must also declare the method to be public.
    class (static) method - a method in a class defined to belong to the class, and not to instances of the class

    Note that it wasn't necessary to create an instance of Foo in order to call the static method.
    class (static) variable - much like a static method, this is a variable defined in a class to belong to the class, not to instances of the class

    Note that it wasn't necessary to create an instance of the Foo class in order to access and use the static variable i.
    concrete classes - A class that is not abstract.

    final method - such a method cannot be overridden in a subclass

    inheritance - a mechanism whereby one class definition can extend another, where the extending (sub)class inherits some (or all) of the behaviors (methods) defined in the extended (base) class
    This is a fundamental concept of object-oriented programming.

    Note that even though the Foo class does not define a method named method, the foo instance has access to the one defined in the parent class Bar.
    interface - a mechanism for categorizing/marking implementing classes with another data type
    Note that since only single inheritance is allowed in Java (that means a class can be defined to extend at most one other class), this implementing of interfaces is especially useful for developing well designed, polymorphic code.
    Above is an example using an interface. For a greater understanding of the role of interfaces and just what polymorphism is, spend a few minutes reading the "How my Dog learned Polymorphism" story of the JavaRanch Campfire Stories.
    overriding - where a subclass declares a (non-static, non-private) method with the same signature as one in a parent class.

    postcondition - something concerning the state of a system (or object) that may have changed after a method is invoked
    In other words, something that is true after a method is called - something concerning an object's state, that is.
    precondition - something that must be true before a method is called
    This might be something about the state/value of a method parameter, or something about the state of the object that has the method being called.
    Making any sense?


    [How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Help With Classes Needed