Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

interface doubts

Posted on 2004-03-30
10
212 Views
Last Modified: 2012-05-04
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
Comment
Question by:psk_karthik
10 Comments
 
LVL 37

Expert Comment

by:zzynx
ID: 10713199
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
 

Author Comment

by:psk_karthik
ID: 10713247
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
 
LVL 30

Accepted Solution

by:
Mayank S earned 100 total points
ID: 10713286
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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 30

Expert Comment

by:Mayank S
ID: 10713301
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
 
LVL 37

Expert Comment

by:zzynx
ID: 10713349
>>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
 
LVL 30

Expert Comment

by:Mayank S
ID: 10713406
>> "if you do that" == "NOT implementing all methods defined in the interface"

Yes.

>> It's begging for spam too.

Yes ;-)
0
 
LVL 24

Expert Comment

by:sciuriware
ID: 10713686
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
 
LVL 30

Expert Comment

by:Mayank S
ID: 10876662
Please proceed with that recommendation.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Application launch issue with Apache Tomcat 5 64
tomcat not starting 6 68
arguments to jar 5 35
null output 3 35
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question