DEV Community

AmalaReegan
AmalaReegan

Posted on

1

Day 15 Task 3

  1. Create a package called bank.chennai.
  2. Create a public class called ‘SBI’.
  3. Have default non-static variables String empName, empId.
  4. Have default static variable branch_name = ‘chennai’
  5. Create two default, non-static methods get_loan(int amount), create_account() with void as return datatype.
  6. Now, in the same package(bank.creditcard), create one more default class called Account_Holder.
  7. Have main method in this class.
  8. Try to access all static, non-static variables and non-static methods in SBI class.
  9. Create another package called bank.madurai.
  10. In this package, create default class called Account_Holder_Madurai.
  11. Have main method in this class.
  12. Try to access all static, non-static variables and non-static methods in SBI class.
  13. Note down the Errors and rectify those errors and make sure this class gives output without any error.

Source code:

package bank.chennai;

public class SBI
{
String empname,empid;
public static String branch_name="chennai";
public void get_loan(int money)
{
System.out.println("got loan money"+" "+money);
}
public void create_account()
{

}

}

Source code:

package bank.creaditcard;

import bank.chennai.SBI;

public class Account_holder extends SBI
{

public static void main(String[] args)
{

Account_holder acc=new Account_holder();
acc.create_account();
acc.get_loan(10000);
System.out.println(SBI.branch_name);
}
}

Source code:

package bank.madurai;

public class Account_holder_madurai
{

String empname,empid;
public static String branch_name="chennai";
public void get_loan(int money)
{
System.out.println("got loan money"+" "+money);
}
public void create_account()
{

}

}

Image description

Heroku

Built for developers, by developers.

Whether you're building a simple prototype or a business-critical product, Heroku's fully-managed platform gives you the simplest path to delivering apps quickly — using the tools and languages you already love!

Learn More

Top comments (0)

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

👋 Kindness is contagious

If you found this post useful, consider leaving a ❤️ or a nice comment!

Got it