Link to home
Start Free TrialLog in
Avatar of gudii9
gudii9Flag for United States of America

asked on

Use interfaces only to define types


Use interfaces only to define types

I was reading above staemtent. I have not understood the statement, concept behind clearly.
Please advise. Any ideas, sugestions, sample code, links, resources highly appreciated. thanks in advance
Avatar of Mick Barry
Mick Barry
Flag of Australia image

its saying use interfaces to define types and *not* to simply store constants

eg. this is bad

public interface Constants {
   public static final int A = 5;
   public static final int B = 6;
   public static final int C = 7;
}
Avatar of gudii9

ASKER

>>use interfaces to define types

which types you mean. please advise
ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gudii9

ASKER

>>
means types you define in your application

eg.

public interface Person {
..



you mean object instance variable types like



public interface Person {
Address a;
Contact c;
..


please advise