package Stats;
public class Players {
private String name;
private int RIT;
private int TIR;
private int PAS;
private int REG;
private int DEF;
private int FIS;
private int MED;
public Players (String name, int RIT, int TIR, int PAS, int REG,
int DEF, int FIS, int MED) {
this.name= name;
this.RIT = RIT;
this.TIR = TIR;
this.PAS = PAS;
this.REG = REG;
this.DEF = DEF;
this.FIS = FIS;
MEDIA = MED;
}
public static void main (String[] args) {
Players player1 = new Players ("aa", 5,3,7,1,7,9,8);
System.out.println(player1);
}
}
我正在尝试使用println打印所有变量,但它所做的只是打印“ Stats.Players@14c3d7e”,如果我输入println(name +“ \ n” + RIT + ....);它说我不能从非静态上下文中做到这一点。 我该如何解决?