ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
# 基本步骤 ## 键盘录入数据的步骤 A:导包(位置放到class定义的上面) > import java.util.Scanner; B:创建对象 > Scanner sc = new Scanner(System.in); C:接收数据 > int x = sc.nextInt(); 例:判断出三个数中最大的数 ``` package com.igeek.day01; import java.util.Scanner; public class Test6 { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); System.out.println("请输入数字a:"); int a =sc.nextInt(); System.out.println("请输入数字b:"); int b =sc.nextInt(); System.out.println("请输入数字c:"); int c =sc.nextInt(); int max = (a>b)?a:b; int result = (max>c)?max:c; System.out.println(result); } } ```