Java中的实例究竟是什么? [英] What exactly is an instance in Java?

查看:487
本文介绍了Java中的实例究竟是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对象,实例和引用有什么区别?他们说他们必须为他们的应用程序创建一个实例?这是什么意思?

What is the difference between an object, instance, and reference? They say that they have to create an instance to their application? What does that mean?

推荐答案

对象和实例是相同的东西

我个人更喜欢在引用特定类型的特定对象时使用instance一词,例如Foo类型的实例。但是在谈论一般的对象时,我会说对象而不是实例。

Personally I prefer to use the word "instance" when referring to a specific object of a specific type, for example "an instance of type Foo". But when talking about objects in general I would say "objects" rather than "instances".

引用要么指特定对象,要么它可以是空引用。

A reference either refers to a specific object or else it can be a null reference.


他们说他们必须为他们的应用程序创建一个实例。这是什么意思?

They say that they have to create an instance to their application. What does it mean?

他们可能意味着你必须这样写:

They probably mean you have to write something like this:

Foo foo = new Foo();

如果您不确定应该实例化哪种类型,请联系应用程序的开发人员并要求提供更完整的例子。

If you are unsure what type you should instantiate you should contact the developers of the application and ask for a more complete example.

这篇关于Java中的实例究竟是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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