iZhirO

Contructor

Nov 11th, 2018
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.75 KB | None | 0 0
  1. class constru {
  2.         int age,weight,height;
  3.         String name;
  4.        
  5.             public constru(String name, int age, int height, int weight) {
  6.                 this.name = name;
  7.                 this.age = age;
  8.                 this.height = height;
  9.                 this.weight = weight;
  10.             }
  11.            
  12.             public void getInfo() {
  13.                 System.out.printf("Name : %s\n",this.name);
  14.                 System.out.printf("Age : %d\n",this.age);
  15.                 System.out.printf("Height : %d (arround that)\n",this.height);
  16.                 System.out.printf("Weight : %d (arround that)",this.weight);
  17.             }
  18.     }
  19.      
  20.      
  21. public class con{
  22.     public static void main(String[] args) {
  23.         constru info = new constru("Zamm", 19, 175, 50);
  24.         info.getInfo();
  25.         }
  26.     }
Advertisement
Add Comment
Please, Sign In to add comment