Advertisement
Massta

Testat02Lösung

Nov 29th, 2013
479
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.38 KB | None | 0 0
  1. public class Aktion{
  2.     private int i,k;
  3.     public Aktion(int p){
  4.         i = p*10;
  5.         k = 10;
  6.     }
  7.  
  8.     public void set(int q){
  9.         i = q/1; //oder so ^^
  10.     }
  11.  
  12.     public int get(){
  13.         return i;
  14.     }
  15. }
  16.  
  17. // Neue Klasse
  18.  
  19. public class Rechner{
  20.     private Aktion akt;
  21.     public Rechner(Aktion a){
  22.         akt = a;
  23.     }
  24.  
  25.     public int doIt(int i){
  26.         if(i > 0){
  27.             akt.set(i*100);
  28.         }
  29.         return akt.get();
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement