📄 localinnerclassdemo.java
字号:
interface GPRS{
public void position();
}
class Car{
String brand;
String color;
GPRS tools;
public Car(String 牌子,String 颜色,final int miles){
brand = 牌子;
color = 颜色;
class GPRStool implements GPRS{
public void position(){
System.out.println("您的"+brand +"车已经行走了"+miles +"英里, 现在的位置是广州");
}
}
tools = new GPRStool();
}
public void getMiles(int miles){
System.out.println("您行走了"+ miles + "英里");
}
public void show(){
System.out.println("这是一辆"+ color +brand +"车");
tools.position();
}
}
public class LocalInnerClassDemo{
public static void main(String arg[]){
Car 捷达 = new Car("捷达","黑色",50000);
捷达.show();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -