Skip to content

Instantly share code, notes, and snippets.

@samiron
Last active December 14, 2015 19:58
Show Gist options
  • Select an option

  • Save samiron/5140275 to your computer and use it in GitHub Desktop.

Select an option

Save samiron/5140275 to your computer and use it in GitHub Desktop.
class Person
{
private String name ;
private int id;
/**
* Receives the name and set in instance variable
*/
public void setName(String name){
this.name = name;
}
/**
* Returns the name of the instance
*/
public String getName(){
return this.name;
}
/**
* Receives id and set in instance variable
*/
public void setId(int id){
this.id = id;
}
/**
* Returns the id of the instance
*/
public int getId(){
return this.id;
}
}
public class StudentTester
{
public static void main(String[] args)
{
Person john = new Person();
john.setName("Johnty Rhodes");
john.setId(11);
System.out.println(john.getName());
System.out.println(john.getId());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment