내가이 내가 얻을 오류입니다는
오류 HelloWorld.java
에서 newhello.java에서을 rtnval 전화를 시도하고 다른 파일에 메소드로부터 정보를 검색 기호 기호 : 방법 newhello() 위치 : 클래스 HelloWorld를
오류 : (10, 28) 자바는 : 메소드 된 newval() 위치 : 기호 기호를 찾을 수없는 수준을 HelloWorld
public class HelloWorld {
public static void main (String[] args){
System.out.println("Test");
int fnum1 = addition(8,2);
System.out.println(fnum1);
int fnum2 = subtract(2,8);
System.out.println(fnum2);
newhello newval = newhello();
System.out.println(newval());
}
public static int addition (int num1, int num2){
int total;
total = num1 + num2;
return total;
}
public static int subtract (int num1, int num2){
int total;
total = num1 - num2;
return total;
}
}
public class newhello extends HelloWorld {
public static void main (String[] args){
System.out.println(rtnval());
}
public static String rtnval(){
String msg;
msg = "Test";
return msg;
}
}
나는 그 방법을 사용하여 인스턴스를 호출해야한다는 인상하에 있었습니까 ??
해결책은 해결책이었습니다. 나는 또한 적절하게 NewHello로 이름을 바꿨다. 나는 System.out.println (NewHello.rtnval())과 함께 아무 문제도 호출 할 수 없었다; 질문. 어떤 상황에서 "비 정적"이 재생 될 것인가? –