Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package prj12062021;
- public class MainClass {
- public static void main(String[] args) {
- Point p1 = new Point();
- p1.print();
- System.out.println(p1);
- Point p2 = new Point();
- p2.setX(3);
- p2.setY(4);
- p2.print();
- Point p3 = new Point(3, 4);
- p3.print();
- Point p4 = p1;
- p4.print();
- System.out.println(" p1 ***************");
- System.out.println("p1==p2 : " + (p1 == p2));
- System.out.println("p1==p3 : " + (p1 == p3));
- System.out.println("p1==p4 : " + (p1 == p4));
- System.out.println(" p2 ***************");
- System.out.println("p2==p3 : " + (p2 == p3));
- System.out.println("p2==p4 : " + (p2 == p4));
- System.out.println("p2.equals(p3) : " + p2.equals(p3));
- System.out.println("from p1 to p2 : " + p1.distance(p2));
- System.out.println("from p2 to p1 : " + p2.distance(p1));
- System.out.println("from p2 to p3 : " + p2.distance(p3));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement