DEV Community

hema latha
hema latha

Posted on

Bank task

  1. Create a class called Bank.
  2. Have main method in it. public static void main(String[] args)
  3. Create an object called 'bank'. Bank bank = new Bank()
  4. Using 'bank' object, call deposit(1000) bank.deposit(1000);
  5. Create a method deposit(int amount)
  6. return 1000 - 500 from this method.
  7. Store the returned value as amount.
  8. Print the amount

package terminaltask;

public class Bank {

public static void main(String[] args)
{

// TODO Auto-generated method stub
Bank indian = new Bank();
int amount = indian.deposit(1000);
System.out.println(amount);
}
public int deposit (int amount)
{
return 1000-500;
}

out put -- 500
}

Top comments (0)