Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Interface vs Abstract Classes

I am a little bit familiar with the difference between Abstract and Interface classes but What do you think is the meaning of the sentence below?

An interface can only define constants while abstract class can have fields.

like image 989
newbie Avatar asked Mar 02 '26 03:03

newbie


1 Answers

An interface can only define constants while abstract class can have fields.

your field from interface is by implicitly public, static, final

which isn't case with abstract class

like image 82
jmj Avatar answered Mar 04 '26 15:03

jmj