Using Abstract Class Methods

I just want to know that in how many ways can we use the non abstract methods of the class without extending the class(dont want to implement all abstract methods of the parent class).One way is that if the methods are static then we can use CLASSNAME.METHODNAME().Is their any other way of doing it

[306 byte] By [JAVA.RULZa] at [2007-11-26 22:31:21]
# 1

none at all. not a single one. by definition, a non-static method has to be invoked on a particular instance of a class, and an abstract class cannot be instantiated. somebody is probably going to say you can do this:

abstract class AbstractClass {

abstract void minceAbout();

void talkRubbish() {

// do stuff

}

}

....

new AbstractClass() {

void minceAbout() {}

}.talkRubbish();

but that is extending the AbstractClass, no matter what their argument. why d'you ask, anyway? why not implement the methods? sounds like a design smell

georgemca at 2007-7-10 11:36:51 > top of Java-index,Java Essentials,New To Java...
# 2

another way is :

creating a object for that class which contains method u want.

then objectName.methodName();

ex:

class abst

{

void fun1()

{

.........

}

}

p.s.v.main(String []a)

{

abst a=new abst();

a.fun1();

}

Java@kondala at 2007-7-10 11:36:51 > top of Java-index,Java Essentials,New To Java...
# 3

> another way is :

> creating a object for that class which contains

> method u want.

> then objectName.methodName();

> ex:

> class abst

> {

>void fun1()

> {

>.........

>

> }

> p.s.v.main(String []a)

> {

>abst a=new abst();

> fun1();

> }

re-read the question

georgemca at 2007-7-10 11:36:51 > top of Java-index,Java Essentials,New To Java...
# 4
Really a cool stuff.. i love it..but one concept i didn't understand here.. how come instance of an abstract class become a extended class instance ?
cracjana at 2007-7-10 11:36:51 > top of Java-index,Java Essentials,New To Java...