当前位置: 技术问答>java相关
大哥大姐帮帮忙
来源: 互联网 发布时间:2017-04-13
本文导语: public class Rect(){ public int x1,y1,x2,y2; public Rect(int x1,int y1,int x2,int y2){ this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2; } public Rect(int width,int height){this(0,0,width,height);} public Rect(){this(0,0,0,0);} public void...
public class Rect(){
public int x1,y1,x2,y2;
public Rect(int x1,int y1,int x2,int y2){
this.x1 = x1;
this.y1 = y1;
this.x2 = x2;
this.y2 = y2;
}
public Rect(int width,int height){this(0,0,width,height);}
public Rect(){this(0,0,0,0);}
public void move(int deltax,int deltay){
x1 += deltax; x2 += deltax;
y1 += deltay; y2 += deltay;
}
public boolean isInside(int x,int y){
return ((x >= x1) && (x = y1) && (y r.x1)?this.x1:r.x1,
(this.y1>r.y1)?this.y1:r.y1,
(this.x2result.y2){result.y1 = result.y2 = 0;}
return result;
}
public String toString(){
return "[" + x1 + "," + y1 + " ; " + x2 + "," + y2 + "]";
}
}
编译提示,不会改
public class Rect(){
^
D:workspacetest001Rect.java:42: '}' expected
}
2 errors
Process completed.
public int x1,y1,x2,y2;
public Rect(int x1,int y1,int x2,int y2){
this.x1 = x1;
this.y1 = y1;
this.x2 = x2;
this.y2 = y2;
}
public Rect(int width,int height){this(0,0,width,height);}
public Rect(){this(0,0,0,0);}
public void move(int deltax,int deltay){
x1 += deltax; x2 += deltax;
y1 += deltay; y2 += deltay;
}
public boolean isInside(int x,int y){
return ((x >= x1) && (x = y1) && (y r.x1)?this.x1:r.x1,
(this.y1>r.y1)?this.y1:r.y1,
(this.x2result.y2){result.y1 = result.y2 = 0;}
return result;
}
public String toString(){
return "[" + x1 + "," + y1 + " ; " + x2 + "," + y2 + "]";
}
}
编译提示,不会改
public class Rect(){
^
D:workspacetest001Rect.java:42: '}' expected
}
2 errors
Process completed.
|
把()去掉不就OK了
您可能感兴趣的文章:
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。