suppose we have an interface & that interface contains five
methods. if a class implements that interface then we have
to bound that to give tha definition of all five methods in
that class. If we declare that class as abstract then can
we call only two methods to give the deinition of that
method & i don't want to give the definition of all the
methods? can it possible

Answer Posted / nitin

yes it is possible, just make rest of the method abstract
explictly.

Example:
public interface Human {
public void canEat();
public void canThink();
public void canTalk();
public void canImegine();
public void canLove();

}
public abstract class Man implements Human {

public abstract void canEat();

public abstract void canImegine();
@Override
public abstract void canLove();

@Override
public void canTalk() {

}

@Override
public void canThink() {
}

}

public class Nitin extends Man{

/**
* @param args
*/
public static void main(String[] args) {
}

@Override
public void canEat() {

}

@Override
public void canImegine() {

}
@Override
public void canLove() {

}
}

Is This Answer Correct ?    29 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the synchronized method modifier?

895


What are the topics in core java?

843


What are JVM.JRE, J2EE, JNI?

916


Is main an identifier?

796


What is a dot notation?

792


What does string [] args mean?

776


What is java oops?

804


Does every java program need a main?

797


Is static a singleton?

767


Define locale.

838


What is lastindexof in java?

791


What is the += operator called?

838


When parseint method can be used?

749


Hi.... I applied for the post of scientific officer/Engineer-SB(Programmer).Please post the syllabus and sample papers.

1786


Why are the methods of the math class static?

843