Reputation: 841
I am using JDK - C:\Program Files (x86)\Java\jdk1.8.0_60
However, (on an earlier question I asked) a SO user gave me a Java8 solution to my problem:
int[] luckyArray = new Random().int(1, 59).distinct().limit(6).toArray();
I copied the code into my Main class and it is not resolving. Any idea why?
Upvotes: 1
Views: 88
Reputation: 2720
You have a mistype in your code. The red underline means that you have a syntax error. A good way to get rid of those is to hover your mouse over the error to get an explanation, then put the blinking cursor on it press alt + enter
in IntelliJ IDEA to get a list of suggestions to fix the issue. If you suspect that you don't have the correct method typed, selecting the whole method (int
) in your case and pressing ctrl + space
will show a list of methods that you can use on that object. As you type, you will get more specific suggestions.
Upvotes: 2
Reputation: 56
It's not the problem of IntelliJ IDEA, but your code.
int[] luckArray = new Random().ints(1, 59).distinct().limit(6).toArray();
See it, ints not int.
Upvotes: 2