Class, interface, or enum expected when compiling

﹥>﹥吖頭↗ 提交于 2019-12-14 03:36:57

问题


I sat down and tried to write code for this prompt, and I made this.
However, when I compile it in BlueJ, I get: class, interface, or enum expected.

1) How do I fix this error? It seems like I forgot something, but I cant remember what I forgot.

2) Do you think I fulfilled what the prompt was asking?

Thanks.


回答1:


I'm not going to do your homework for you but here are some hints:

  1. You need to put all your code inside a class
  2. You need to put the code in the main method. (Search on Google) the method served for an entry point.
  3. You only need one for loop... Loop through the array, if the value equals 0, return the index number. After the loop just return -1.


来源:https://stackoverflow.com/questions/27854297/class-interface-or-enum-expected-when-compiling

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!