+ 1

Why it doesn't work here

Only here"Cannot find symbol" import java.util.*; public class Program { public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.println(Arrays .stream(scan.nextLine().split(" ")) .map((w)->{ switch (w){ case("10"): w="ten"; break; case("9"): w="nine"; break; case("8"): w="eight"; break; case("7"): w="seven"; break; case("6"): w="six"; break; case("5"): w="five"; break; case("4"): w="four"; break; case("3"): w="three"; break; case("2"): w="two"; break; case("1"): w="one"; break; } return w; }).collect(Collectors.joining(" "))); } }

8th Aug 2020, 1:52 PM
Otakoe
Otakoe - avatar
3 odpowiedzi
+ 2
// add also import java.util.stream.Collectors;
8th Aug 2020, 2:04 PM
zemiak
8th Aug 2020, 2:28 PM
👑Mahesh Khatri👑
👑Mahesh Khatri👑 - avatar
0
Thx. Hm interesting. I thought that import java.util.*; adds all including stream.Collectors
8th Aug 2020, 2:22 PM
Otakoe
Otakoe - avatar