We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

Use interfaces only to define types

gudii9
gudii9 asked
on
Medium Priority
225 Views
Last Modified: 2012-05-11

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
Comment
Watch Question

Mick BarryJava Developer
CERTIFIED EXPERT
Top Expert 2010

Commented:
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;
}

Author

Commented:
>>use interfaces to define types

which types you mean. please advise
Java Developer
CERTIFIED EXPERT
Top Expert 2010
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview

Author

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
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.