Advertisement
Arfizato

point pointnom

Jan 9th, 2022
810
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.59 KB | None | 0 0
  1. class Point{
  2.     int x,y;
  3.     public Point(int x, int y){
  4.         this.x=x;
  5.         this.y=y;
  6.     }
  7.     public void affcord(){
  8.         System.out.println("coordinates: ("+x+", "+y+").");
  9.     }
  10. }
  11.  
  12. public class PointNom extends Point{
  13.     String nom;
  14.     PointNom(int x, int y, String nom){
  15.         super(x,y);
  16.         this.nom= nom;
  17.     }
  18.     public void affcordNom(){
  19.         System.out.println("Point "+nom+": ("+x+", "+y+").");
  20.     }
  21.  
  22.     public static void main(String[] args) {
  23.         PointNom zoubi = new PointNom(1,2,"chra9abaw");
  24.         zoubi.affcordNom();
  25.     }
  26. }
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement