Skip to content

Instantly share code, notes, and snippets.

@0xh3x
Created January 18, 2012 16:05
Show Gist options
  • Save 0xh3x/1633748 to your computer and use it in GitHub Desktop.
Save 0xh3x/1633748 to your computer and use it in GitHub Desktop.
package com.giorgijvaridze.playground;
public class Person {
private String first_name = "No name";
private String last_name;
private int age;
public static int objCount = 0;
public static void printObjCount(){
System.out.println(objCount);
}
public Person() {
objCount++;
System.out.println("Created new Object");
}
private Person(String first_name, String last_name, int age) {
this.first_name = first_name;
this.last_name = last_name;
this.age = age;
}
public void setFirstName(String first_name) {
this.first_name = first_name;
}
public String getFirstName() {
return first_name;
}
public void setLastName(String last_name) {
this.last_name = last_name;
}
public void setAge(int age) {
this.age = age;
}
public void printInfo() {
String result = String.format("name:%s lastname:%s age:%d", first_name,
last_name, age);
System.out.println(result);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment