面向对象Demo02

方法的调用的回顾

package oop;
​
public class Demo02 {
    //静态
    public static void main(String[] args) {
        //student student = new student();
        student.speak();
        //非静态
//student student = new student();
    }
}
package oop;
​
public class student {
    public static void speak() {
        System.out.println("说话");
    }
}
package oop;
​
public class Demo03 {
    public static void main(String[] args) {
        int a = 1;
        System.out.println(a);//1
        Demo03.change(a);
​
        System.out.println(a);//1
    }
    //返回值为空
    public static void change(int a) {
        a=10;
    }
}

打卡!打卡!打卡!打卡!打卡!

面向对象Demo02_第1张图片

你可能感兴趣的:(java)