Java学习Day18

Java学习Day18

内存分析

Java学习Day18

public class Applicantion {
    public static void main(String[] args) {

        Pet dog = new Pet();
        dog.name = "旺财";
        dog.age = 3;
        dog.shout() ;

        System.out.println(dog.name);
        System.out.println(dog.age);

        Pet cat = new Pet();
        
    }
}
publc class Pet {

    //public 权限较高
    public String name;
    public int age;

    //无参构造
    public void shout(){
        System.out.println("叫了一声");
    }
}
i
上一篇:数据采集实战(二)-- 京粉商品(by puppeteer)


下一篇:函数的例题