#i don't get the difference between implementation class and a concrete class

1 messages · Page 1 of 1 (latest)

near compass
#

as the title says i'm currently reviewing my notes on java for my exam and i got two explanations but when i try to read them i don't see the difference. my understanding is that both terms mean a class that implements all of the methods in the interface it's implementing.
the explanation in my notes:
concrete class: A concrete class is a class that provides implementations for all abstract methods that it inherits or an interface specifies, and therefore objects of the class can be created.
implementation class: An implementation class is a realization of an abstraction that is defined by an interface. In Java, the class is declared to implement the interface.

sinful yarrowBOT
#

<@&987246964494204979> please have a look, thanks.

#

Here is an AI assisted attempt to answer your question 🤖. Maybe it helps! In any case, a human is on the way 👍. To continue talking to the AI, you can use </chatgpt:1108714622413963314>.

#
TJ-Bot
As the title says i'm currently reviewing my notes on java for my exam and i got two explanations but when i try to read them i don't see the difference. my understanding is that both terms mean a class that implements all of the methods in the interface i

An implementation class in Java is a class that implements an interface, providing the actual code for the methods defined in the interface. On the other hand, a concrete class is a regular class that can be instantiated and used directly. While an implementation class is a specific type of concrete class, not all concrete classes are implementation classes.

Useful links:

safe garden
#

I haven't studied these terms yet, but it sounds like the concrete class is referring to a sub-class that implements all of the methods from its parents.

The second one sounds a bit more vague or abstract... its hard to tell

near compass
#

yeah that's what i don't get too

iron bolt
near compass
#

i see that's why i didn't get anything online

iron bolt
#

i suppose what they want to say is that when u write Foo implements Bar, a class is implementing an interface

#

either partially or fully, doesnt matter

#

while "concrete class" means that at the end of the day, u must have a class that eventually has everything implemented

#

like, u can make a class that only implements 2 of 10 abstract methods, great. but u cant instantiate that (new Foo())

#

u can also extend that class and implement 7 more of the 8 remaining methods

#

great, still cant create instances of that

#

only once u extend it another time to implement the last remaining abstract method, only then do u have a "concrete class" that u can make isntances of

#

or in other terms, every actual instance/object that u encounter during runtime of a java program must have all abstract methods implemented

#

so at the end of the day everything must be fully implemented

near compass
#

i see so an implementation class doesn't need to be able to be instanciable but a concrete class need to be able to?

iron bolt
#

one doesnt exclude the other. my guess is that "implementing class" they just want to say "someone used implements"

#

"concrete class" probably refers to the final form, the end of an inheritance chain, a class where nothing is abstract anymore

#

the way i understand their "terms":

near compass
#

that does make a lot of sense thank you so much

iron bolt
#
interface Foo {
  void method1();
  void method2();
}

abstract class Bar implements Foo {
  @Override
  void method1() {...}
  // method2 is still unimplemented
}

class Baz extends Bar {
  @Override
  void method2() {...}
  // great, everything is there now
}
#

so Bar in this example must still be declared an abstract class since its not fully done yet

#

no one can ever write new Bar()

#

but Baz is done, its a concrete class

#

new Baz() works

#

but both, Bar and Baz, are "implementing classes" as they implement the interface Foo

near compass
#

i see i'll reword my notes so it's easier to understand