The Artima Developer Community
Sponsored Link

Java Answers Forum
Difference between an interface and a class

5 replies on 1 page. Most recent reply: Nov 6, 2002 1:45 PM by Thomas SMETS

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 5 replies on 1 page
Tony

Posts: 4
Nickname: wdk
Registered: Nov, 2002

Difference between an interface and a class Posted: Nov 4, 2002 12:12 PM
Reply to this message Reply
Advertisement
Can somebody give me the Difference between an interface and a class, pls


Thomas SMETS

Posts: 307
Nickname: tsmets
Registered: Apr, 2002

Re: Difference between an interface and a class Posted: Nov 4, 2002 2:44 PM
Reply to this message Reply
I wonder if you can read ?
May be just type in ... & expecting a voice coming & wispering you an answer ?
Bruce Eckel is providing free books on the internet so RTFM or STFW

Anyway,
Let's not make this longer than it should ...
An interface is the outside view of what the instance of an Object. You know that every instance of the class implementing that interface is accepting specific requests (as defined on the interface).

The class is the conceptual mold for the instances.

for a first answer this should be enough,

Thomas,

Charles Bell

Posts: 519
Nickname: charles
Registered: Feb, 2002

Re: Difference between an interface and a class Posted: Nov 4, 2002 3:43 PM
Reply to this message Reply
interface

A Java(TM) programming language keyword used to define a collection of method definitions and constant values. It can later be implemented by classes that define this interface with the "implements" keyword.

class
In the Java(TM) programming language, a type that defines the implementation of a particular kind of object. A class definition defines instance and class variables and methods, as well as specifying the interfaces the class implements and the immediate superclass of the class. If the superclass is not explicitly specified, the superclass will implicitly be Object.

See http://java.sun.com/docs/glossary.print.html

Tony

Posts: 4
Nickname: wdk
Registered: Nov, 2002

Re: Difference between an interface and a class Posted: Nov 5, 2002 6:50 AM
Reply to this message Reply
then what is the diff between an abstract class and an interface

Tony

Posts: 4
Nickname: wdk
Registered: Nov, 2002

Re: Difference between an interface and a class Posted: Nov 5, 2002 8:40 AM
Reply to this message Reply
there is something called decency....

Thomas SMETS

Posts: 307
Nickname: tsmets
Registered: Apr, 2002

Re: Difference between an interface and a class Posted: Nov 6, 2002 1:45 PM
Reply to this message Reply
Tony,

The abstract class provides some implementation for some methods, while the interface cannot provide any implementation.

An abstract class has no purpose if it is not extended by (one or more) classes which can rely on the (already) provided implementation (or not) to provide some specific behavior.

Thomas,


p.s. :
Hi Charles,
Long time I haven't seen you around.
How's going ?

---------
Thomas SMETS,
SCJP2, Brussels
yahoo-id : smetsthomas

Flat View: This topic has 5 replies on 1 page
Topic: Homework Help Previous Topic   Next Topic Topic: error code - 1073741819

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use