Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.37 KB | None | 0 0
  1. public class Person
  2. {
  3.     private int height;
  4.     private int weight;
  5.  
  6.     public Person(int h, int w)
  7.     {
  8.         height = h;
  9.         weight = w;
  10.     }
  11. }
  12.  
  13. /* now, in a different file, say your file w/ main in it */
  14.  
  15. public static void main(String args[])
  16. {
  17.     Person person;
  18.     person = new Person(6, 200);
  19.     // now 'height' inside 'person' is 6, and 'weight' inside 'person' is 200
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement