[3357] in java-interest

home help back first fref pref prev next nref lref last post

JAVA: What are ABSTRACT CLASSES etc.?

daemon@ATHENA.MIT.EDU (Michael Mehrle)
Wed Nov 8 23:32:53 1995

Date: Wed, 8 Nov 1995 17:26:57 -0700
To: java-interest@java.sun.com
From: michael@w3media.com (Michael Mehrle)


I'm a beginner in Java (only know Perl - thank God, otherwise I'd really be
busted) and while learningfrom the new book "Java!" by Tim Ritchey and the
Java documentation at Sun's site, I'm having difficulties understanding the
basic principle of several topics:

1) What the hell are "abstract classes"? The book describes it as "classes,
which are made up of methods that have not been completed. It's up to the
subclasses of the abstract class to override the method." I've no idea what
that means. I understand the basic "extending" of classes by creating
subclasses which override certain methods. So far so good. But I've no idea
what "abstract classes do...
HELP!

2) Which brings me to "interfaces" which don't make sense to me either.
What is the major difference between an "interface" and a "superclass"? The
book says the advantage is that you can define the protocols for an
abstract class without worrying about the specific implementation, leaving
that until later. WHY?

3) Casting Classes. Allright, casting integers to longs - no problemo - I
even understand the typwrapping
function of the Boolean or Integer classes. But casting classes? The book
(again..) says: "You can cast from a superclass to a subclass implicitly,
without an explicit call for conversion, although explicit casts to
subclasses are not an error." Daaah! <8^P
Anybody?

4)And finally - yes 'threading'.
 There are two different ways that you can provide a customized run()
method for a Java thread:

      1.Subclass the Thread class defined in the java.lang package and
        override the run() method.
      2.Provide a class that implements the Runnable interface, also defined
        in the java.lang package. Now, when you instantiate a thread (either
        directly from the Thread class, or from a subclass of Thread), give
        the new thread a handle to an instance of your Runnable class. This
        Runnable object provides the run() method to the thread.

I don't understand the second method. (Maybe cause I don't know so much
about applets yet and - see above I have no idea what interfaces are ).
Anybody knows?

No, I'm not a total moron, but I think that both - the book (especially)
and also the online documentation do anticipate
too much of a background in Object Oriented Programming - which I lack.
Does anybody speak English and
is able to drop a few lines to help me? In return, I could "redesign your
website a bit - I am an excellent designer!!
Check out my URL: http://www.w3media.com/w3media/

Have mercy with a beginner and HELP!

Michael Mehrle



                  ||||
                  o  o
____________OOOo___<>___oOOO_______________
     http://www.w3media.com/w3media
          michael@w3media.com
           Tel. 310.441.9599
           Fax  310.441.5919

"One man's mondane and desperate existence
     is someone else's Technicolor."
            -Strange Days-


-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post