Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 243
  • Last Modified:

interface doubts

is it necessary to load all the method in the interface?what are the default modifire of the interface?
plz mail me psk_karthik@hotmail.com
0
psk_karthik
Asked:
psk_karthik
1 Solution
 
zzynxSoftware engineerCommented:
1) Completely unclear what you mean
    Load a method of an interface? How do you do that?
2) Answering questions by e-mail is not how it works here at EE.
0
 
psk_karthikAuthor Commented:
when we implementing the interface is it possible to load all the methods of the interface ? and also the default access modifier of the interface?
0
 
Mayank SAssociate Director - Product EngineeringCommented:
I don't understand what you mean by 'load', but I will try to answer whatever I have understood from your question:

1. It is not important to implement (provide the code for) all methods defined in the interface - but if you do that, then your class has to be declared as abstract.

2. All methods that you implement (which were declared in the interface) must be given the 'public' modifier in the implementing class.

Mayank.
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

 
Mayank SAssociate Director - Product EngineeringCommented:
And secondly, DON'T give e-mail IDs in your question-pages. We're supposed to answer your questions here, not on mails. Sometimes, the moderators don't like it if they see e-mail IDs on question-pages.
0
 
zzynxSoftware engineerCommented:
>>It is not important to implement (provide the code for) all methods defined in the interface - >>but if you do that, then your class has to be declared as abstract.

"if you do that" == "NOT implementing all methods defined in the interface"

>> DON'T give e-mail IDs in your question-pages.
It's begging for spam too.
0
 
Mayank SAssociate Director - Product EngineeringCommented:
>> "if you do that" == "NOT implementing all methods defined in the interface"

Yes.

>> It's begging for spam too.

Yes ;-)
0
 
sciuriwareCommented:
If not clear yet:

say, you have a class Xyz implements Interf

that means that you promise to implement all methods defined in 'Interf' in 'Xyz'
     in order to make 'Xyz'  "look like an Interf".

If you do not implement all those methods, your class is not going to look like an 'Interf' at all
     and unacceptable for all references to 'Interf'.

So, if somewhere there is a variable:

       Interf  pointer;

JAVA demands that it will always point at a 'Interf' look-alike.

Do you understand that?

;JOOP!
0
 
Mayank SAssociate Director - Product EngineeringCommented:
Please proceed with that recommendation.
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.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

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