Point类的构造函数

import java.util.*;
class Point{
	int a;
	int b;
	Point() {
		a=0;
		b=0;
	}
	Point(int a,int b) {
		this.a=a;
		this.b=b;
	}
	public void showPoint() {
		System.out.println("("+a+","+b+")");
	}
}
public class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		
		Point m=new Point();
		m.showPoint();
		int x=sc.nextInt();
		int y=sc.nextInt();
		Point n=new Point(x,y);
		n.showPoint();
		
		sc.close();
	}
}

相关文章:

  • 2021-12-03
  • 2021-09-30
  • 2021-07-02
  • 2021-05-17
  • 2022-02-06
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-06-21
  • 2022-12-23
  • 2021-09-18
  • 2021-12-28
  • 2021-07-16
相关资源
相似解决方案