I'm new to Java and I'm quite confused on how to return 2 parameters. Am I supposed to make an if statement? For example, for the method below how would I go about in writing a return statement? or maybe it's my constructor?
public Cell getAir(int a, int b) {
return cells[a][b];
}
this is my actual code
private Air[][] pair;
public Grid(int width, int height) {
Air[][] pair = new Air[width][height];
width = width;
height = height;
if(width == 0 ||height == 0) {
} throw new IllegalArgumentException("Height or Width value is less than or equal to zero");
}
public Grid(Airl[][] cells) {
if(pair != null && pair.length > 0) {
for(int i=0; i < pair.length; i++) {
if(pair[I] == null || pair[I].length == 0)
{ throw new IllegalArgumentException("Width value is null or equal to zero"); } } }
else { throw new IllegalArgumentException("Height value is null or equal to zero"); }
}
public int getHeight() {
return pair[0].length;
}
public int getWidth() {
return pair[0].length;
}
public Air getAir(int a, int b) {
return air[a][b];