Void methods cannot return a value

前端 未结 10 2269
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-23 01:38

I\'m following the CS106A lectures online. I\'m going through the code on Lecture 12, but it\'s giving me errors in Eclipse.

This is my code. It seems the error is beca

10条回答
  •  春和景丽
    2021-01-23 02:03

    You cannot have such nested methods in Java. CS106A is a class. main() and toLower() are two methods of it. Write them separately.

    As for String[] args in the main() method argument it is similar to saying int arc, char **argv in C if you have learned it before. So basically args is an array where all the command line arguments go.

提交回复
热议问题