?
The invocation of a variable in a class should actually be: the object name. Variable Name
1.this represents the object that called the member, usually omitting the object name, which omits this. However, the variable with the same name cannot be omitted when it participates. As in the following scenario:
Public void setnum(String num)
{
This . num = num;
}
?
2. When another constructor is called in one of the constructors in the same class, you can use this to call directly. However, when used, the sentence containing this must be placed in the first line of the code block. As in the following scenario:
public Time(long totaltime)//以特定时间(ms)构造time对象的构造方法
{
this(totaltime / 1000, totaltime / 60000, totaltime / 3600000);//调用以特定时,分,秒为参数的构造方法,传入转化后的流失时间
}
?
public Time(long totalsecond, long totalminute, long totalhour)
{
/*将已流失的时间转化为当前的时间*/
currsecond = totalsecond % 60;
currminute = totalminute % 60;
currhour = totalhour % 24;
}
The purpose of this Java learning Note