编译时需要的类,接口或枚举 [英] Class, interface, or enum expected when compiling

查看:106
本文介绍了编译时需要的类,接口或枚举的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我坐下来,尝试为此提示编写代码,然后我做了

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)如何解决此错误?好像我忘记了什么,但我不记得自己忘记了什么.

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

2)您认为我满足了提示的要求吗?

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

谢谢.

推荐答案

我不会为您做家庭作业,但是这里有一些提示:

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

  1. 您需要将所有代码放入
  2. 您需要将代码放入 main方法中. (在Google上搜索)用于入口点的方法.
  3. 您只需要一个for循环...循环遍历数组,如果值等于0,则返回索引号.循环之后,只需返回-1.
  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.

这篇关于编译时需要的类,接口或枚举的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆