输出坐标

来源:互联网 发布:php开发网站 编辑:程序博客网 时间:2024/06/10 03:24
public class Point {int x;int y;Point (int x,int y){this.x = x;this.y = y;}Point(int x){this.x = x;y = x;}Point(){x = 0;y = 0;}void show_point(){System.out.println("坐标为("+x+","+y+")");}}public class Point_test {public static void main(String[] args) {// TODO Auto-generated method stubPoint point1 = new Point();point1.show_point();Point point2 = new Point(3);point2.show_point();Point point3 = new Point(2,4);point3.show_point();}}

原创粉丝点击