madhawaseeeee

oop

Sep 8th, 2018
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.68 KB | None | 0 0
  1. public class Dog {
  2.  
  3.     String color="black";
  4.     int height;
  5.     int weight;
  6.    
  7.     static String type="sheera";
  8.    
  9.     public Dog(int height, String color) {
  10.        
  11.         this.height = height;
  12.         this.color = color;
  13.        
  14.         System.out.println("creating a new dog");
  15.        
  16.     }
  17.  
  18.     public  void bark() {
  19.         System.out.println("barking buh buh");
  20.     }
  21.  
  22.     public void me() {
  23.         System.out.println("my color is " + this.color + " and my height is " + this.height);
  24.     }
  25.  
  26.     public void jump() {
  27.         System.out.println("JUMPING");
  28.     }
  29.     public void myType(){
  30.         System.out.println("my type is "+this.type);
  31.     }
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment