import java.util.Scanner;
class Xiti
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
System.out.println("请输入数据:");
int score = sc.nextInt();
intA(score);
System.out.println("y="+y);
}
public static int intA(int x){
int y = 0;
if(x>0){
y = x + 3;
}
else if(x==0){
y = 0;
}
else{
y = x*x-1;
}
return y;
}
}
请问这个定义了y了为什么说打印语句找不到变量y? |
|