Sample program using Encapsulation

Input:

class Bank
{
String name;
int loan;
private int interest;

public Bank(String name, int loan, int interest)
{
this.name = name;
this.loan = loan;
this.interest = interest;
}
public static void main(String[] args)
{
Bank SBI = new Bank(“Aravind”,1000,5);
SBI.receive();

}

private void receive()
{
System.out.println(interest);
}

}

Input:

class Bank2
{
public static void main(String[] args)
{
Bank canara = new Bank(“Dev”,5000,2);
canara.receive();
}
}

Output:

原文链接:Sample program using Encapsulation

© 版权声明
THE END
喜欢就支持一下吧
点赞6 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容