Advertisement
Guest User

Java

a guest
Mar 13th, 2015
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.52 KB | None | 0 0
  1. public class Pont{
  2.     private int x;
  3.     private int y;
  4.    
  5.     public Pont(int x, int y){
  6.         this.x = x;
  7.         this.y = y;
  8.     }
  9. }
  10.  
  11. -----------------------------------
  12.  
  13. public class Pontok{
  14.     private Pont[] pontok;
  15.  
  16.     public Pontok(){
  17.         this.pont = new Pont[0];
  18.     }
  19.  
  20.     public void pontHozzaAd(Pont pontxy){
  21.         Pont[] ujPont = new Pont[pont.length+1];
  22.                 for(int i = 0; i<pont.length;i++){
  23.                     ujPont[i] = pont[i];
  24.                 }
  25.                 ujPont[ujPont.length-1] = pontxy;
  26.             pont = ujPont;
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement