028-86922220

建站动态

根据您的个性需求进行定制 先人一步 抢占小程序红利时代

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.tsicrk.com/article/goochd.html

其他资讯

让你的专属顾问为你服务

2.0719s