This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
HI all, Just got this question on Interfaces in one of the mocks, Select all correct answers about what is the definition of an interface? A) It is a blue print B) A new data type C) Nothing but a class definition D) To provide multiple inheritance According to me the answer should be A and D. but according to the mock exam answers its A,B and D. How can an interface be Data type? Regards, Harjinder
Hello Harjinder, Looking up in the JLS produced this definition of an interface
An interface declaration introduces a new reference type whose members are classes, interfaces, constants and abstract methods. This type has no implementation, but otherwise unrelated classes can implement it by providing implementations for its abstract methods
So we can very well say that an interface is a new data type because we kind of take the term "data type" to be more generic form the term "reference type". U know we refer to objects using the term "reference types" and not to primitive types. But ofcourse the option is somewhat confusing. What I feel is if you want to justify option B, you can do it, but it is not a very clear or straight forward choice. Cheers Anupreet
Joined: May 02, 2001
Hi Pals, Thanks for the replies. so going by that thinking that interfaces can be data type as we can reference new classtypes of other members through it, so acthat means an abstract class type or even a simple class declaration also should be a new data type. Isnt it wrong to say that classes, interfaces, abstract classes are new data types as they are not at all data types rather they are references and are not related to datatypes as such. Regards, Harjinder