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
LVL 7
gudii9Asked:
Who is Participating?
 
objectsConnect With a Mentor Commented:
means types you define in your application

eg.

public interface Person {
...
0
 
objectsCommented:
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;
}
0
 
gudii9Author Commented:
>>use interfaces to define types

which types you mean. please advise
0
 
gudii9Author Commented:
>>
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
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.