| 123456789101112131415161718192021222324 |
- package p1;
- /**
- * @author WanJl
- * @version 1.0
- * @title p1.Dog
- * @description
- * @create 2026/7/20
- */
- public class Dog {
- // 属性 Dog类的属性,其实就是成员变量
- double weight; //成员变量 就是全局变量
- double height;
- //方法
- public static void main(String[] args) {
- //创建了Dog对象
- Dog d=new Dog();
- //通过Dog对象,调用这个对象的属性
- d.height=15.6;
- d.weight=3.14;
- }
- }
|