Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
405 views
Welcome To Ask or Share your Answers For Others

1 Answer

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.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...