I have a program that currently I'm trying to create a player with customizable integers. I use this object:
public class Player {
public String player = null;
private int Strength=0;
private int Defense=0;
private int Magic=0;
private int Resistance=0;
private int Skill=0;
private int Luck=0;
public Player(String name, int int1, int int2, int int3, int int4, int int5, int int6) {
this.player = name;
this.Strength = int1;
this.Defense = int2;
this.Magic = int3;
this.Resistance = int4;
this.Skill = int5;
this.Luck = int6;
}
}
I use this main class to run it, and set the integer and string values.
public class Main {
public static void main(String[] args) {
Player[] playerList = new Player[] {new Player("Player1", 3, 3, 2, 1, 1, 3),new Player("Player2", 1, 1, 1, 1, 1, 1)};
}
}
However, whenever I attempt to print this, it prints this:Player@659e0bfd I looked through similar questions, but I am not sure where to put the @Override in my program, and if I need to do something different since I have multiple integers, and a string. I only want the string to print out. (Also, is there a way to print out just one part of the playerList, ie. the first section "Player1")