新网创想网站建设,新征程启航

为企业提供网站建设、域名注册、服务器等服务

java构造类方法

public user(int a,int b)
{
    this.a=a;
    this.b=b;
}
public user(int a,int b,int c)
{
    this(a,b);
    this.c=c;
}

在第二个方法中,不能使用第一个方法名来构造,只能使用this,并且只能放在第一行。
this不能用于static方法中,因为this只能用于对象中

当前标题:java构造类方法
文章网址:http://www.wjwzjz.com/article/goochd.html
在线咨询
服务热线
服务热线:028-86922220
TOP