Last active
March 30, 2019 19:03
-
-
Save isauravmanitripathi/e29d150ad7c31c3e7c4b5f118a72fc1d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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