Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package nesting;
- public class Father {
- /* ============================================================
- methods in the class Father can access PRIVATE
- members of this NESTED class !!!
- ============================================================ */
- private class BankAccount {
- private double accountNumber; // *** Private variable !!! ***
- private String transferee; // *** Private variable !!! ***
- public BankAccount (double x) {
- accountNumber = x;
- transferee = null; // It's good to make next to point to illegal null
- }
- }
- private BankAccount bankAccount; // **** Access SHOULD be set to private ****
- // Constructor
- public Father () {
- bankAccount = null; // Make an empty list
- }
- /* ====================================================
- put( x ): store value x into the list
- ==================================================== */
- public void put (double x, String name) {
- BankAccount e;
- e = new BankAccount(x);
- e.transferee = name; // You can use PRIVATE variables in BankAccount !
- // Store this in a server DB or pass it over REST
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement