[program-l] Re: Java ????

  • From: Andreas Stefik <stefika@xxxxxxxxx>
  • To: program-l@xxxxxxxxxxxxx
  • Date: Wed, 28 Nov 2018 11:27:15 -0800

Folks,

The explanations people have given so far are really close, but not quite
correct. In Java, an interface is different than an abstract class.
Notably, an interface tells the compiler that there are a list of methods
that anything inheriting must also have. Interfaces cannot be instantiated.
An abstract class in Java has some methods without an implementation, but
have some with.Abstract classes, as well, cannot be instantiated. IDETS is
the name of the interface. The reason Java made this decision was because
classes can have as many interfaces as they like, but only one abstract
parent, because they don't allow multiple inheritance like C++ does.

Breaking it down, this piece of code is an interface, named IDETS, that has
one method in it, named localA. Using it, one would "implement" the
interface in a subclass.

HTH,

Stefik

On Wed, Nov 28, 2018 at 9:34 AM Roger Woolgrove <rawoolgrove@xxxxxxxxx>
wrote:

Hi
It is the basic framework of an interface.
In an interface there will be a number of mtthod headers ending with semi
colon.
No code is given for the methods but any implementing class must specify a
definition for each of the methods stated.

No idea what IDETS means, usually there should be some annotation prior to
the declaration to say what the interface is for.

roger



On 28/11/2018 17:29, Corbett, James wrote:

I found this code in one of our old programs but it don’t make sense to me?

*public* *interface* IDets {

        *void* localA();
}


Help?

J.

James (Jim) Corbett
613 941-2438

CS2 (Programmer - Analyst)






Other related posts: