이 코드를 실행하면 다음 오류가 발생합니다. 오류 : 비 정적 필드에 대한 정적 참조를 작성할 수 없습니다. 오류 : 11 번 코드로 총이 발생 비 정적 필드 D 에 정적 참조 할 수 없습니다 :정적 인 Java 정적 참조 (단, 정적 만 사용하고 있음)
import java.util.Scanner;
class problemStatement
{
int c = 0, d = 0;
public static void main(String [] args)
{
Scanner in = new Scanner(System.in);
System.out.println("Please enters two integers - 0 0 to end program");
do
{
c = in.nextInt();
d = in.nextInt();
System.out.print("User input: " + c + " " + d + " " + displayValues);
if (isFinished(c,d))
{
System.out.println("End of Program.");
}
else
{
displayValues (c,d);
}
}while(!isFinished(c,d));
}
public static int min (int a, int b)
{
if (a >=b)
{
return b;
}
else
{
return a;
}
}
public static int max (int a, int b)
{
if (a >=b)
{
return a;
}
else
{
return b;
}
}
public static boolean isFinished (int a, int b)
{
if (a==0&&b==0)
{
return true;
}
else
{
return false;
}
}
public static void displayValues (int a, int b)
{
int e = min(a,b);
int f = max(a,b);
System.out.print("Max value: " + e + " Min value: " + f);
}
}
을 나는이 안돼서, 코드의 일부는하지만, 중복 동의하고이 정도에있다 Java에 대해 더 많이 배울 수 있습니다. 도움을 주시면 감사하겠습니다.
검색 엔진에 오류 텍스트를 넣고 결과를 읽으려고 했습니까? –
'c'와'd'는 무엇입니까? –
@SotiriosDelimanolis 예,하지만 내 특정 문제와 관련된 아무것도 찾을 수 없습니다, 그들은 모두 비 정적을 사용하여 실제로 정적을 참조하는 것과 관련이 있습니다. 그러나 모든 메서드가 정적입니다. –