Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.55 KB | None | 0 0
  1. package University;
  2.  
  3. public class Human {
  4.     public String getName() {
  5.         return name;
  6.     }
  7.  
  8.     public void setName(String name) {
  9.         this.name = name;
  10.     }
  11.  
  12.     public int getAge() {
  13.         return age;
  14.     }
  15.  
  16.     public void setAge(int age) {
  17.         this.age = age;
  18.     }
  19.  
  20.     private String name = "Dima";
  21.     private int age = 25;
  22.  
  23.     public void greeting() {
  24.         System.out.println("Hi! I am a human");
  25.     }
  26.  
  27.     public void howOldYou() {
  28.         System.out.println("I am "+ this.getAge() + " years old");
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement