gpt4 book ai didi

java - 继承会将类变成对象吗?

转载 作者:太空宇宙 更新时间:2023-11-04 14:15:24 25 4
gpt4 key购买 nike

例如。当我创建一个类时;

 public class CPlogo extends JFrame{

}

“CPlogo”类现在固有一个对象还是只是 JFrame 类的方法?

我很想了解更多相关信息,如果有的话请给我一些好的教程。我已经在 YouTube 上看过了,但还是看不懂...

最佳答案

Inheritance in java is a mechanism in which one object acquires all the properties and behaviors of parent object.

The idea behind inheritance in java is that you can create new classes that are built upon existing classes. When you inherit from an existing class, you can reuse methods and fields of parent class, and you can add new methods and fields also.

Inheritance represents the IS-A relationship, also known as parent-child relationship.

参见thisthis了解更多信息。希望对您有所帮助。

关于java - 继承会将类变成对象吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27813245/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com