Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Main {
- public static void main(String[] args) {
- Account account1 = new Account(1, "Alice", "New York");
- account1.view();
- Account account2 = new Account(2, "Zoe", "California");
- account2.view();
- }
- }
- class Account {
- int number;
- String name;
- String address;
- Account(int number, String name, String address) {
- this.number = number;
- this.name = name;
- this.address = address;
- }
- 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