Java 根据行断点和消息[Method Name]无法解析为类型,错误是什么?
第一:您已将grosser声明为一个方法,因此不能使用new关键字。第二:您正在从main调用grosser,这是一个静态方法,所以grosser也应该声明为staticJava 根据行断点和消息[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
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);
}
}