java吧 关注:1,238,193贴子:12,707,903
  • 2回复贴,共1
1. F ill up statements in the following program which called KeyboardInput, to prompt user to input an int, a double, and a String. The output shall look like this (the inputs are shown in red cycles ): import java.util.Scanner; //导入所需类用以键盘读取:Scanner类public class KeyboardInput{public static void main(String[] args){int num1;double num2;String name;double sum;//实例化Scanner对象in,用以读取键盘输入,(System.in)固定用法Scanner in = new Scanner(System.in);_____ = in.nextInt(); //通过对象in调用nextInt()方法读取整型数据______________________________________________________ = in.nextDouble(); //调用nextDouble()方法读取浮点数据______________________________________________________ = in.next(); //调用 next()方法读取字符串数据//输出语句_________________________________________________}}


IP属地:浙江1楼2013-04-09 10:32回复
    import java.util.Scanner; //导入所需类用以键盘读取:Scanner类public class KeyboardInput{public static void main(String[] args){int num1;double num2;String name;double sum;//实例化Scanner对象in,用以读取键盘输入,(System.in)固定用法Scanner in = new Scanner(System.in);num1 = in.nextInt(); //通过对象in调用nextInt()方法读取整型数据
    num2 = in.nextDouble(); //调用nextDouble()方法读取浮点数据sum=num1+num2;name = in.next(); //调用 next()方法读取字符串数据//输出语句System.out.println("Hi!"+ name +",the sum of"+ num1 +"and"+ num2 + "is"+sum);}}


    IP属地:浙江2楼2013-04-09 10:33
    回复
      好像还差一些什么


      IP属地:浙江3楼2013-04-09 10:33
      回复