[英]Can constructor return data types in java like methods?
I have a question in java object oriented programming. 我在Java面向对象编程中有一个问题。
Can constructors return data types like methods in java? 构造函数可以返回Java中的方法之类的数据类型吗?
Constructors always return an object of the class they belong to, just like specified in the Java Language Specification . 构造函数总是返回其所属类的对象,就像Java语言规范中所指定的那样。
Unlike method return types, the constructor "return type" is implicit. 与方法返回类型不同,构造函数“返回类型”是隐式的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.