0
package com.testo.project1;

public class mathe {
    static int zahl1;
    static int zahl2;
    static int erg;

    public static void main(String[] args) {

        add(5,4);       

    }

    public static void add(){

        zahl1 = this.zahl1;
        zahl2 = this.zahl2;
        erg=zahl1+zahl2;
        System.out.println(erg);
    }




}

このコードが機能しないのはなぜですか? メソッドを呼び出すと、2 つの int があります。メソッドにはオブジェクトが必要ですか??

4

3 に答える 3