I am using Intellij IDEA.
Here is my code:
public static void main(String[] args) { java.util.Scanner scanner = new java.util.Scanner(System.in); int a = scanner.nextInt(); System.out.println(a); }
The problem is that when I run it, it works. But Intellij cannot find the Scanner class. It emphasizes the red color.
How to fix it?
First you must import the scanner as follows:
import java.util.Scanner;// in the top!
and then try the following:
public static void main(String[] args) { Scanner scan = new Scanner(System.in); int a = scan.nextInt(); System.out.println(a); }
Source: https://habr.com/ru/post/977619/More articles:How to safely add the file name to the argument of the path to the Windows folder? - windowsIn Jade, how can you call a function in external Javascript - javascriptDjango Rest Framework object not repeating? - pythonFast / SpriteKit multiple collision detection? - iosAsset catalog for Retina 4 2x images not available on iPhone 6 - iosError: a problem was found with the task setting collectDebugMultiDexComponents - androidOAuth: how to set dynamic callback url? - angularjsScikit-learn custom evaluation function requires values ββfrom a dataset other than X and y - pythonAndroid is the best way to sync SQLite with MySQL - androidC unix domain sockets, recvfrom () does not install struct sockaddr * src_addr - cAll Articles