||
Java中的Scanner~C中的scanf,即程序运行后是需要等待键入内容的。
import java.util.Scanner;
public class JL {
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
double a=input.nextDouble();
double b=input.nextDouble();
double a2 = fg.f(3);
double b2 = fg.g(5);
System.out.print(a2 + b2);
}
//方法fg()
public static class fg {
static int f(int x) {
return (x * 10);
}
static int g(int y) {
return (y * 100);
}
}
}
控制台输出5,回车,输入3,回车,输出:
530.0
Copyright ©2011-2014 bbs.06climate.com All Rights Reserved. Powered by Discuz! (京ICP-10201084)
本站信息均由会员发表,不代表气象家园立场,禁止在本站发表与国家法律相抵触言论