Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Main {
- public static void main(String[] args) {
- new Account(1, "Alice", "New York").view();
- new Account(2, "Zoe", "California").view();
- }
- }
- class Account {
- private int number;
- private String name;
- private String address;
- private Account() {
- }
- public Account(int number, String name, String address) {
- this.number = number;
- this.name = name;
- this.address = address;
- }
- public void view() {
- System.out.println("Number: " + number);
- System.out.println("Name: " + name);
- System.out.println("Address: " + address);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment