Advertisement
Guest User

Untitled

a guest
Nov 14th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.96 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6.  
  7. /**
  8.  *
  9.  * @author ja
  10.  */
  11. public class Main {
  12.     static class Prostokat
  13.     {
  14.        private int wysokosc, szerokosc;
  15.         public Prostokat(int wysokosc, int szerokosc)
  16.                 {
  17.                     this.wysokosc = wysokosc;
  18.                     this.szerokosc = szerokosc;
  19.                     System.out.println(this);
  20.                 }
  21.         public String toString()
  22.         {
  23.          return "Wysokosc = " + wysokosc + " " + "Szerokosc = " + szerokosc;      
  24.                 }
  25.        
  26.        
  27.     }
  28.  
  29.     /**
  30.      * @param args the command line arguments
  31.      */
  32.     public static void main(String[] args) {
  33.        
  34.         Prostokat p1 = new Prostokat(3,5);
  35.         Prostokat p2 = new Prostokat(4,9);
  36.        
  37.        
  38.        
  39.     }
  40.    
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement