小编Nar*_*mar的帖子

是否可以使用void返回类型的构造函数?

我想知道是否可以使用void返回类型的构造函数,如下例所示.

例如

class A
{
    void A(){}  //where A is constructor and for which return type is void

    public static void main(string arg[]){
        A a = new A();
    }
}
Run Code Online (Sandbox Code Playgroud)

java constructor

-4
推荐指数
1
解决办法
535
查看次数

标签 统计

constructor ×1

java ×1