子类混淆 [英] subclass confusion

查看:155
本文介绍了子类混淆的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要为以下代码创建一个子类。我打算使用extends关键字,但是教师说使用= new关键字。我不明白= new关键字。有人可以解释差异,并可能提供基于以下代码的示例。

I need to make a subclass for the following code. I was planning on using the extends keyword but the instructor says to use =new keyword. I do not understand the = new keyword. Can someone please explain the difference and possibly provide an example based on the following code.

展开 | 选择 | Wrap | 行号

推荐答案


我需要制作一个以下代码的子类。我打算使用extends关键字,但是教师说使用= new关键字。我不明白= new关键字。有人可以解释差异,并可能提供基于以下代码的示例。
I need to make a subclass for the following code. I was planning on using the extends keyword but the instructor says to use =new keyword. I do not understand the = new keyword. Can someone please explain the difference and possibly provide an example based on the following code.
展开 | 选择 | Wrap | 行号



你确定你的教授是指代码当你被告知使用''new'时子类的?通常,在声明对象时使用''new''关键字,例如在上面的代码中:

Are you sure that your professor was referring to the code of the subclass when you were told to use ''new''? Generally the ''new'' keyword is used when declaring an object, such as in your code above:

展开 | < span class =codeLinkonclick =selectAll(this);>选择 | Wrap | 行号



我知道你所说的你不需要使用extends关键字。具有static void main的文件将通过= New关键字调用otherfile.java。所以我现在非常喜欢如何添加这个子类
all i know u he said "You do not need to use the extends keyword. The file with the static void main will call the otherfile.java into existence via the =New keyword." so i am very ocnfused now about how to add this subclass



1)你不是一个代码的子类而是一个类

2)你不能在没有使用扩展的情况下创建一个子类

3)也许你应该想出一个不同类型的inventorysupplystock2类,并用main方法中的新类替换当前的类。 (所有与子类无关)

1) You do not make a subclass of code but of a class
2)You cannot make a subclass without using extends
3)Perhaps you are supposed to come up with a different type of inventorysupplystock2 class and replace the current one with the new one in the main method. (All which have nothing to do with subclassing)


这篇关于子类混淆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆