class Testing
{
public static void ischeck()
{
Scanner sc=new Scanner(System.in);
int a=sc.nextInt();
System.out.println("hello"+a);
//print value of aa that given by user
}
public static void main(String str[])
{
ischeck();
}
}
**我的要求是在用户定义函数中获取扫描器类值
答案 0 :(得分:-3)
import java.util。*;
班级测试 {
public static void someMethod()
{
Scanner sc = new Scanner(System.in);
int text = sc.nextInt();
System.out.println(text);
}
public static void main(String str[])
{
someMethod();
}
}