Java: float[][] points
I am using an open source program but I don't understand how I should write this class.
Room
public Room(float[][] points)
Creates a room from its name and the given coordinates.
I guessed it was something like
Room Parallelogram_Room = new Room{{0f,0f},{0f,400f},{625f,400f},{625f,400f},{625f,0f},{0f,0f}};
but it gives an error, or
Room Parallelogram_Room = new开发者_运维问答 Room([0f][0f]);
but still gives an error.
Please, I am stuck!
You're messing up the syntax. Wrap the array with parenthesis.
To make it more clear, create the array and then pass it into the constructor.
float[][] points = {{0f,0f},{0f,400f},{625f,400f},{625f,400f},{625f,0f},{0f,0f}};
Room Parallelogram_Room = new Room(points);
Use Room room = new Room(new float[][] { {3, 4}, {4, 5}, {4, 6} });
精彩评论