Home > Back-end >  Some of the problems for bosses, Java
Some of the problems for bosses, Java

Time:10-05

The code
Define two class

During the class {
Int year;
During the public Year (int) {
During this.=year;
}

Public int getValue () {
Return this. The year;
}

During public void setValue (int) {
During this.=year;
}
}

CLSS Date {
During the Year.

Public DateUtil () {
Year=New Year ();

}

Public DateUtil (int y) {

QWQ

}

The public Year setYear () {
Return this. The year;
}

Public void setYear (Year Year) {
During this.=year;
}
}

Can I enter a y from the main function, the Date the Date=new Date (y);
Then how I will y values assigned to the custom during the class
Public DateUtil (int y) {

}

Should write? Turn to




CodePudding user response:

???? Assignment in the calling line.

CodePudding user response:

What=y;

CodePudding user response:

 CLSS Date {
During the Year.

Public DateUtil () {
Year=New Year ();

}

Public DateUtil (int y) {

QWQ this place

}

The public Year setYear () {
Return this. The year;
}

Public void setYear (Year Year) {
During this.=year;
}
}


This kind of writing, you compile?

 CLSS Date {
During the Year.

Public Date () {
During this.=New Year ();

}

Public Date (int y) {

The area/moving/QWQ
During this.=New Year (y);
}

The public Year getYear () {
Return this. The year;
}

Public void setYear (Year Year) {
During this.=year;
}
}

CodePudding user response:

refer to the original poster flower sakura sake く RisuG response:

the codeDefine two class
Should write? Help


Code like upstairs writing can
 
Public Date (int y) {
During this.=New Year (y);
}


But first you write too many problems, turned out to have a different construction method in the name of the class name, the second Year in a class without construction method, how do you call Year no arguments structure! ? Foundation is too bad, a lot more than well,
 
Public DateUtil () {
Year=New Year ();
}

CodePudding user response:

reference 4 floor qq_39936465 response:
Quote: refer to the original poster flower sakura sake く RisuG response:

The code
Define two class
Should write? Help


Code like upstairs writing can
 
Public Date (int y) {
During this.=New Year (y);
}


But first you write too many problems, turned out to have a different construction method in the name of the class name, the second Year in a class without construction method, how do you call Year no arguments structure! ? Foundation is too bad, a lot more than well,
 
Public DateUtil () {
Year=New Year ();
}


Thank you for your bosses