• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 212
  • Last Modified:

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
0
gudii9
Asked:
gudii9
  • 2
  • 2
1 Solution
 
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
 
objectsCommented:
means types you define in your application

eg.

public interface Person {
...
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

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now