JAVA REGION

Packages and Interfaces

package shortPackageExample;

public class Balance {
    String name;
    double balance;

    public Balance(String name, double balance) {
        System.out.println("Dedfault Constructor");
        this.name=name;
        this.balance=balance;
        }

    void show() {
        if (balance < 0) {
            System.out.println("Low balance");

        } else {
            System.out.println("Balance is:" + balance);
        }
    }

}



package shortPackageExample;

public class Balance {
    String name;
    double balance;

    public Balance(String name, double balance) {
        System.out.println("Dedfault Constructor");
        this.name=name;
        this.balance=balance;
        }

    void show() {
        if (balance < 0) {
            System.out.println("Low balance");

        } else {
            System.out.println("Balance is:" + balance);
        }
    }

}


Post a Comment