Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/react-native/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 根据行断点和消息[Method Name]无法解析为类型,错误是什么?_Java_Methods - Fatal编程技术网

Java 根据行断点和消息[Method Name]无法解析为类型,错误是什么?

Java 根据行断点和消息[Method Name]无法解析为类型,错误是什么?,java,methods,Java,Methods,第一:您已将grosser声明为一个方法,因此不能使用new关键字。第二:您正在从main调用grosser,这是一个静态方法,所以grosser也应该声明为static package practice; import java.util.*; import java.lang.reflect.Method; public class max { public int grosser(int a,int b){ if(a>b){ retu

第一:您已将grosser声明为一个方法,因此不能使用new关键字。第二:您正在从main调用grosser,这是一个静态方法,所以grosser也应该声明为static

package practice;

import java.util.*;
import java.lang.reflect.Method;

public class max {

    public int grosser(int a,int b){

        if(a>b){

        return a;

        } else {

        return b;

        }


    }

    public static void main(String[] args){

        int a,b;
        System.out.println("Geben Sie zwei Zahlen ein:");

        Scanner s1 = new Scanner(System.in);
        a = s1.nextInt();

        System.out.println("Geben Sie zweite Zahl ein");
        Scanner s2 = new Scanner(System.in);
        b = s2.nextInt();

        max m = new max();

        int g = new grosser(a,b);
        //hier appear the Error Message 
        //Line break pointer 
        //grosser cannot be resolved to a type
hier ist the problem and i don't know how i can make further
please help me

        System.out.println("Größte Zahl:"+g);

    }

}