Skip to content

Instantly share code, notes, and snippets.

@isauravmanitripathi
Last active March 30, 2019 19:03
Show Gist options
  • Save isauravmanitripathi/e29d150ad7c31c3e7c4b5f118a72fc1d to your computer and use it in GitHub Desktop.
Save isauravmanitripathi/e29d150ad7c31c3e7c4b5f118a72fc1d to your computer and use it in GitHub Desktop.
// Account.java
// Account class with a constructor that initialize the name.
public class Account {
private String name; // instance variable
// constructor initializes name with parameter name
public Account(String name) { // constructor name is class name
this.name = name;
}
// method to set the name
public void setName(String name) {
this.name = name;
}
// method to retrieve the name
public String getName() {
return name:
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment