Pergunta de entrevista da empresa Salesforce

Another question was: what's the difference between an abstract class and an interface. Can a class inherit both from an abstract class and an interface at the same time?

Respostas da entrevista

Sigiloso

12 de jan. de 2011

Uh, this question is as dumb as the first answer. A Java class can extend at most one class, and implement one or more interfaces. A combination of the above is allowed.

16

Sigiloso

13 de set. de 2011

See this for differences between abstract class and interface, the first part of the question: http://www.interview-questions-java.com/abstract-class-interface.htm

4

Sigiloso

3 de abr. de 2011

I agree with the 2nd post

4

Sigiloso

4 de set. de 2011

Yes, In java class can`t have more than one super class but it can extend a super class and implement interface at one time.

2

Sigiloso

10 de jun. de 2015

Difference between interface and abstract is , abstract can contain both abstract and non-abstract that is concrete methods, but interface has only all abstract methods....and i agree with ans 2

Sigiloso

14 de nov. de 2010

The answer is yes in C++ but no in Java.