登录
首页 >  文章 >  java教程

日间封装

来源:dev.to

时间:2024-12-20 13:57:21 387浏览 收藏

IT行业相对于一般传统行业,发展更新速度更快,一旦停止了学习,很快就会被行业所淘汰。所以我们需要踏踏实实的不断学习,精进自己的技术,尤其是初学者。今天golang学习网给大家整理了《日间封装》,聊聊,我们一起来看看吧!

输入1:

朋友1类
{
字符串名称;
长移动否;
int atmPin;

public Friend1(字符串名称, 长手机号, int atmPin)
{
this.name = 名称;
this.mobileNo = mobileNo;
this.atmPin = atmPin;
}

public static void main(String[] args)
{
Friend1 f1 = new Friend1("Kavin", 1234, 1111);
f1.withdraw();
}
private voidwithdraw()
{
System.out.println(atmPin);
}
公共虚空之旅()
{
System.out.println("去兜风");
}

公共无效publish_results()
{
System.out.println("以好成绩通过");
}

}

输入2:

朋友2类
{

public static void main(String[] args)
{
Friend1 ff = new Friend1("Arul", 3434, 2323);
ff.tour();
ff.withdraw();
}

}

输出:

Image description

终于介绍完啦!小伙伴们,这篇关于《日间封装》的介绍应该让你收获多多了吧!欢迎大家收藏或分享给更多需要学习的朋友吧~golang学习网公众号也会发布文章相关知识,快来关注吧!

声明:本文转载于:dev.to 如有侵犯,请联系study_golang@163.com删除
相关阅读
更多>
最新阅读
更多>
课程推荐
更多>