当我输入以下CODES后,JAVA显示说:无法访问的语句, 应该怎么修改呀?/**
* Method to get the line's x coordinate.
* @return the x coordinate
*/
public int getX() {
return x1;
return x2;
/**
* Method to get the line's y coordinate.
* @return the y coordinate
*/
public int getY() {
return y1;
return y2; }
* Method to get the line's x coordinate.
* @return the x coordinate
*/
public int getX() {
return x1;
return x2;
/**
* Method to get the line's y coordinate.
* @return the y coordinate
*/
public int getY() {
return y1;
return y2; }
如果想返回(x1,x2),可以使用int数组。 public int[] getX() {
return {x1,x2};
}
之后,方法就返回,就无法执行之后的语句