2 Star 0 Fork 0

热门极速下载/hello-java

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Composition.java 593 Bytes
一键复制 编辑 原始数据 按行查看 历史
Brais Moure 提交于 1个月前 . Clase 7 | 21/05/2025
package basic.c08_oop;
/*
Clase 7 - Polimorfismo, abstracción y composición (21/05/2025)
Vídeo: https://www.twitch.tv/videos/2464789369
*/
public class Composition {
public static void main(String[] args) {
// Composición ("tiene un")
var car = new Car();
car.on();
}
public static class Engine {
public void on() {
System.out.println("Motor encendido");
}
}
public static class Car {
final private Engine engine = new Engine();
public void on() {
engine.on();
}
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mirrors_trending/hello-java.git
git@gitee.com:mirrors_trending/hello-java.git
mirrors_trending
hello-java
hello-java
main

搜索帮助