Java 中 this() 是什么意思 [英] what does this() mean in Java

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

问题描述

this() 在 Java 中是什么意思?

what does this() mean in Java?

看起来只有 put 才有效

It looks it is only valid when put

this();

在类变量区.

有人对此有什么想法吗?

Any one has idea about this?

谢谢.

推荐答案

这意味着您正在从另一个构造函数调用默认构造函数.它必须是第一条语句,如果有,则不能使用 super().很少看到它被使用.

It means you are calling the default constructor from another constructor. It has to be the first statement and you cannot use super() if you have. It is fairly rare to see it used.

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

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