刚开始学者的简单问题,怎么调用

J2EE 码拜 7年前 (2017-04-29) 995次浏览
从控制台输入年龄 ,判断大小、 怎么 把 Test 的 age  ,弄到  nl 的 类 的 if 中作比较啊?
import java.util.Scanner;
public class Test {
public static void main(String[] args) {
Scanner in =new Scanner(System.in);
System.out.println(“请输入您的年龄: “);
int age=in.nextInt();
}
public static int nl(int max,int min){
Test ts=new Test();
if(ts.main(age)>max){
System.out.println(“您输入的年龄太大了: “);
}
}
}
解决方案

40

把age也传进去不就行了,nl(int age,int max,int min)刚开始学者的简单问题,怎么调用

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明刚开始学者的简单问题,怎么调用
喜欢 (0)
[1034331897@qq.com]
分享 (0)