Java stream code error

java
#1

my code is below, and have 1 error,but I don’t know how to resolve:

import java.util.stream.* ;
public class StreamTest2
{
public static void main(String args)
{
IntStream.range(1, 4).forEach(s->System.out.println(s));
}
}

error message:
Building StreamTest2.java and running StreamTest2
StreamTest2.java:8: error: illegal start of expression
IntStream.range(1, 4).forEach(s->System.out.println(s));
^

0 Likes