English 中文(简体)
回归和摘要类别?
原标题:Returning and Abstract Class?
  • 时间:2012-01-12 23:11:34
  •  标签:
  • java

我有一等摘要:

public abstract class myClass{    

    public abstract double methodOne();
    // returns the data member value for standard deviation

    public abstract double methodTwo(String myString, int myInt);
    // returns the data member value for mean percentage

}

然后,我有一等可延伸:

public class Abstract extends myClass{

    public double methodOne() {
        return 0.00;
    }

    public double methodTwo(String myString, int myInt) {
        return 20.00;   
    }    
}

最后,我有一个正常的方法,即返回类型是我的地图集。

public myClass anotherMethodOfMine(String myString, int myInt){

}

一个简单的问题确实是,我不理解一种方法如何能够回到另一个包含方法的类别? 是否有人向我解释?

最佳回答

这种方法回收了<代码>MyClass的标语,您可以据此确定的方法。

你们应当理解,一类只是行为和数据的定义。 标的是一个实际实体,能够用数据做事,并能够援引该类界定的行为。

问题回答

即便您的<代码>myClass不能直接(因为其是一个抽象的类别)<代码>Abstract为myClass的子类别;这意味着它有

因此,Abstract“is a” myClass,可作为上级类别的即时回归(myClass)。

页: 1 如果你能够接触我的舱物,并使用我的舱面界定的方法。





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签