| |

VerySource

 Forgot password?
 Register
Search
View: 925|Reply: 3

Problems in java operation

[Copy link]

1

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2021-3-2 11:30:02
| Show all posts |Read mode
import java.util.Scanner;
import java.util.Scanner.*;
import java.io.*;
class Test{
public static void main(String args[]){
Scanner in=new Scanner(System.in);//????
String name=in.nextLine();
String firstname=in.next();
System.out.println(name+" "+firstname);
}
}
Compilation shows Severity and Description Path Resource Location Creation Time Id
Scanner cannot be resolved to a type Test Test.java line 5 1168064887935 1
Scanner cannot be resolved to a type Test Test.java line 5 1168064887935 2
excuse me, can you tell me the reason?
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2021-3-2 13:15:01
| Show all posts
I run your code without any problems. Is your environment not configured properly?
Reply

Use magic Report

1

Threads

14

Posts

12.00

Credits

Newbie

Rank: 1

Credits
12.00

 China

Post time: 2021-3-2 14:30:02
| Show all posts
What is it, is it java?
Reply

Use magic Report

1

Threads

6

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2021-3-2 14:45:01
| Show all posts
java.util.Scanner does not have this package
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list