java_规则


1.一个.java文件中只能有一个public类。例如:此类只能有一个public类BicysleDemo

package bicly;
public class BicycleDemo {
    public static void main(String[] args) {
        Bicycle b1 = new Bicycle();  
    }
}
class Bicycle {
    int cadence = 0;
    public int getCadence() {
        return cadence;
    }
}

posted @ 2023-08-10 21:55  liudelantu  阅读(37)  评论(0)    收藏  举报