|
How we can use a class defined
inside an interface?
or Why we define a class inside an interface? public interface abc
A class is defined inside an interface to bind the interface to a TYPE. A small but nonsense example: interface employee{
In the above interface you are binding the Role type strongly to the employee interface(employee.Role). One more reason is to have modifiable data within an interface(As you may know all fields in an interface are implicitly final). By declaring a class inside the interface you can have common MODIFIABLE data. public interface abc{
I am not sure what you were trying to do with the main() in the interface. Vinay. |
|
See also Do you have a Java Problem?Ask It in The Java Forum Java Books
Return to : Java Programming Hints and Tips All the site contents are Copyright © www.erpgreat.com
and the content authors. All rights reserved.
|