Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. class Main {
  2. public static void main(String[] args) {
  3. System.out.println("Hello world!");
  4.  
  5. Main d= new Main();
  6.  
  7. System.out.println(d.getMonth());
  8. d.setMonth(6);
  9. System.out.println(d.getMonth());
  10. }
  11.  
  12. private int month = 1;
  13.  
  14. public int getMonth(){
  15. return month;
  16. }
  17.  
  18. public void setMonth(int value){
  19. if(value > 0 && value < 13)
  20. month = value;
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement