Article View: a.bsu.programming
Article #1JAVA: What are ABSTRACT CLASSES etc..?
From: Michael Mehrle
Date: Thu, 09 Nov 1995 00:03
Date: Thu, 09 Nov 1995 00:03
68 lines
3143 bytes
3143 bytes
Hi Java Guru:
I'm a beginner in Java (only know Perl - thank God, otherwise I'd really
be busted) and while learning
from 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
--
Michael Mehrle
michael@w3media.com
Technical Details
Message-ID:
<michael-0811951703530001@ppp3.val.net>Path:
arc1-ca.pugleaf.net!ppp3.val.net!userShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!ppp3.val.net!user From: michael@w3media.com (Michael Mehrle) Newsgroups: a.bsu.programming,comp.programming,comp.programming.threads,fj.net.programming,comp.lang.objective-c,comp.object,comp.lang.c++ Subject: JAVA: What are ABSTRACT CLASSES etc..? Date: Wed, 08 Nov 1995 17:03:53 -0700 Organization: w3media Message-ID: <michael-0811951703530001@ppp3.val.net> NNTP-Posting-Host: ppp3.val.net