这样写程序对吗?

huanxiangrushui 2004-03-18 07:58:12
/*MyPoint*/
public class MyPoint{
public class Static Void main (String arg[]){
class MyPoint {
int x;
int y;
}
MyPoint start;
start = new MyPoint();
MyPoint end;
end = new MyPoint();
start.x = start.y = 10;
end.x = end.y = 20;
System.out.println ("Start MyPoint = x:"+start.x+"y"+start.y);
}
}
...全文
31 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
xyjzd 2004-03-18
  • 打赏
  • 举报
回复
public class MyPoint{
int x;
int y;

public static void main (String arg[]){

MyPoint start = new MyPoint();
MyPoint end = new MyPoint();
start.x = start.y = 10;
end.x = end.y = 20;
System.out.println ("Start MyPoint x=" + start.x);
System.out.println ("Start MyPoint y=" + start.y);
System.out.println ("End MyPoint x=" + end.x);
System.out.println ("End MyPoint y=" + end.y);
}
}
以上是我帮你修改的.望高手指点!!
huanxiangrushui 2004-03-18
  • 打赏
  • 举报
回复
谢谢大家,非常感谢!!
j2eexin 2004-03-18
  • 打赏
  • 举报
回复
看了你的代码觉得不对劲,反正按照你的要求改了一下,运行通过.
我也是初学,请高手指教
public class MyPoint{
int x;
int y;

public static void main (String arg[]){

MyPoint start;
start = new MyPoint();
MyPoint end;
end = new MyPoint();
start.x = start.y = 10;
end.x = end.y = 20;
System.out.println (start.x);
}
}
feiyuwen 2004-03-18
  • 打赏
  • 举报
回复
public class MyPoint{
public static void main (String arg[]){
class inner {
int x;
int y;
}
inner start;
start = new inner();
inner end;
end = new inner();
start.x = start.y = 10;
end.x = end.y = 20;
System.out.println ("Start inner = x:"+start.x+"y"+start.y);

System.out.println ("end inner = x:"+end.x+"y"+end.y);
}
feiyuwen 2004-03-18
  • 打赏
  • 举报
回复
错了好多地方
1。 class Static Void main
2。 class MyPoint
。。。
没办法改了

62,614

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧