Java类-入门


概述

1.

示例:

计算矩形面积

class area{
    float lenth;
    float weight;
    flost a(){
        float re=lenth*weight;
        return re;
    }
}
public class b{
    public static void main(String args[]){
        area first;
        first=new area();
        first.lenth=10;
        first.weight=2;
        System.out.print(first.a)
    }
}

2.

3.

4.

5.

参考链接:

文章作者: 古客
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 古客 !
评论
  目录