Advertisement
Guest User

Untitled

a guest
Mar 20th, 2018
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. class MyClass {
  2.  
  3. private int value = 0;
  4. public void setValue(int zmienna) {
  5. value = zmienna;
  6. }
  7. public int getValue() {
  8. return value;
  9. }
  10. }
  11.  
  12.  
  13. class main { -- Twój program czyli on create w androidzie itd.
  14.  
  15.  
  16. MyClass mojaKlasa = new MyClass();
  17. MyClass mojaKlasa2 = new MyClass();
  18.  
  19. mojaKlasa.setValue(2);
  20. System.out.println(mojaKlasa.getValue.tostring); -- to zwróci 2
  21. System.out.println(mojaKlasa2.getValue.tostring); -- to zwróci 0
  22. }
  23. -- Bo posiadasz 2 różne obiekty
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement