Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Person
- {
- private int height;
- private int weight;
- public Person(int h, int w)
- {
- height = h;
- weight = w;
- }
- }
- /* now, in a different file, say your file w/ main in it */
- public static void main(String args[])
- {
- Person person;
- person = new Person(6, 200);
- // now 'height' inside 'person' is 6, and 'weight' inside 'person' is 200
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement