Skip to main content
added 1 characters in body; deleted 278 characters in body
Source Link
Disco
  • 515
  • 1
  • 6
  • 15

Yes and no. The short answer is not the way you're trying to do it there.

If you want to return "two" things, you can encapsulate them into one object that can be returned as a single entity.

eg, a Map or any other collection should do the trick. Alternative, you could return an array.

eg...

private String[] getColidingObject(){ Integer retVal[];

 if(getElementAt(ball.getX(), ball.getY()) != null){ retVal[0] =ball.getX(); retVal[1] =ball.getY(); return retVal; }else if... 

}

Yes and no. The short answer is not the way you're trying to do it there.

If you want to return "two" things, you can encapsulate them into one object that can be returned as a single entity.

eg, a Map or any other collection should do the trick. Alternative, you could return an array.

eg...

private String[] getColidingObject(){ Integer retVal[];

 if(getElementAt(ball.getX(), ball.getY()) != null){ retVal[0] =ball.getX(); retVal[1] =ball.getY(); return retVal; }else if... 

}

Yes and no. The short answer is not the way you're trying to do it there.

If you want to return "two" things, you can encapsulate them into one object that can be returned as a single entity.

eg, a Map or any other collection should do the trick. Alternative, you could return an array.

Source Link
Disco
  • 515
  • 1
  • 6
  • 15

Yes and no. The short answer is not the way you're trying to do it there.

If you want to return "two" things, you can encapsulate them into one object that can be returned as a single entity.

eg, a Map or any other collection should do the trick. Alternative, you could return an array.

eg...

private String[] getColidingObject(){ Integer retVal[];

 if(getElementAt(ball.getX(), ball.getY()) != null){ retVal[0] =ball.getX(); retVal[1] =ball.getY(); return retVal; }else if... 

}