Home > Back-end > Dear leaders, how to solve this little sprout new said too hard
Dear leaders, how to solve this little sprout new said too hard
Time:10-01
/* 1, write a class Point, member variables including int variable x, and y; Float type variable a, b; Static int variable z; Write method setValue (int m, int n) is a member variable x, y assignment, Write method setValue (float a, float b) is a member variable a, b value assignment. Complete the static method output all members () outputs the value of the variable; (this) */
CodePudding user response:
Are you coming water post?
public class Point { Int x, y; Float a, b; Static int z=5; Public void setValue (int m, int n) { X=m; Y=n; }
Public void setValue (float a, float b) { Enclosing a=a; This. B=b; }
Public void the output () { System. The out. Println (" x="+ x +", y="+ y +", a="+ a +", b="+ b +", z="+ z); } }
public class Test { Public static void main (String [] args) { Point Point=new Point (); Point. SetValue (1, 2); Point. The setValue (4.0 3.0 f, f); Point. The output (); } }