So i have this class and i want the coordinates of my shape to be an array but i want to be able to create a shape in my main class and set the coords there. I cant seem to get this right i dont know how to add the array coords as a variable in s1 i want to make an empty array with 2 slots called coords in class Shape. Then i want to be able to fill said array in class main with different numbers for different shapes.
public class Shape
{
private String name;
private int coords[]={0,0};
private double a_p;
public Shape(String name, int[] coords, double a_p)
{
this.name = name;
this.coords = coords;
this.a_p = a_p;
}
this is my main:
public static void Main(String[] args)
{
Shape s1=new Shape("Circle",{3, 4},5);
System.out.println(s1.getCoords());
}