要导入Scanner类 一下两者方式都行,具体区别还未深究。 import java.util.Scanner(它只会导Scanner类,在你所建的类中只可以用util中Scanner类) import java.util.*