asked
Mastering Java Basics with Teacher Eun-jong (Do it! Introduction to Java Programming) - Part 1 (Basics)
Polymorphism and the reasons for using it
Written on
·
380
0
안녕하세요
객체지향 핵심 섹션 5에서 6번째 강의 다형성과 다형성을 사용하는 이유를 듣는데
첫 번째 실습 예제 중에 static으로 선언하는 animalMove 메서드를 main문 안에 적었더니
'void is an invalid type for the variable animalMove' 라는 오류가 발생했는데
main문 안에 선언하면 안되는 이유가 궁금합니다.
Answer 1
1
메서드를 main() 메서드 내부에 넣으시는건 자바 문법에서 허용하지 않습니다.