1 Star 0 Fork 0

chpeng/java_study

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Sample24.java 716 Bytes
一键复制 编辑 原始数据 按行查看 历史
chenhaipeng 提交于 2023-11-22 01:02 +08:00 . update
public class Sample24 {
//
public void fullThrottle() {
System.out.println("这部车正在尽最大能力飞驰!");
}
//
public void speed(int maxSpeed) {
System.out.println("这部车当前的速度是: " + maxSpeed + "km/h");
}
static void myStaticMethod() {
System.out.println("静态声明的方法,可以在没有创建类的实例对象情况下就被调用。。");
}
public static void main(String[] args) {
// 此时类还没有实例对象呢,但是也可以调用static方法 myStaticMethod()
myStaticMethod();
Sample24 myCar = new Sample24();
myCar.fullThrottle();
myCar.speed(120);
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/chp2020/java_study.git
git@gitee.com:chp2020/java_study.git
chp2020
java_study
java_study
master

搜索帮助