Advertisement
Guest User

Untitled

a guest
Aug 30th, 2015
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. public class Invoke {
  2.  
  3. public static void main(String[] args) {
  4. int y = 5;
  5. int z;
  6. Number num = new Number();
  7. num.setX(y);
  8. z = num.getX();
  9.  
  10. System.out.println("The integer is: " + z);
  11. }
  12.  
  13. }
  14.  
  15. class Number {
  16. private int x;
  17.  
  18. public void setX(int a) {
  19. x = a;
  20. }
  21.  
  22. public int getX() {
  23. return x;
  24.  
  25.  
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement