能够查看当前编译几个程式java
方向键+shift :选中行数小程序
设置注释ctrl+/工具
java输入异常,输入值不匹配编译
import java.util.Scanner;class
public class HelloWorld {test
public static void main(String[] args) {
// TODO Auto-generated method stub
// System.out.println("hello,world");
//制做输入
// Scanner in = new Scanner(System.in);
//读取输入的,用in读取下一行
// System.out.println("echo:"+in.nextLine()+",what do you say?");
// System.out.println(2+3+"=2+3=");
// System.out.println("100-23="+(100-in.nextInt()));
//须要读两个数字
// System.out.println("100-"+in.nextInt()+"="+(100-in.nextInt()));
//读一次数字,变量字母,数字,下划线,首字符不能是数字,java是强类型的语言
//变量初始化
//常量
// final int amount = 100;
// int amount;
// int price=0;
//price作赋值,a=b是动做,把b赋给a,右边提供值,左边是接受值。
//表达式
// System.out.print("请输入amount的值:");
// amount = in.nextInt();
// System.out.print("请输入price的值:");
// price = in.nextInt();
// System.out.println(amount+"-"+price+"="+(amount-price));import
//身高换算工具
// int chi;
// int cun;
// float result;
// System.out.println(1.2-1.1);
// 0.09999999999999987
// System.out.print("国外身高换算国内身高");
// Scanner in = new Scanner(System.in);
// System.out.print("请输入的你的英尺数:");
// chi = in.nextInt();
// System.out.print("请输入你的英寸数:");
// cun = in.nextInt();
// System.out.println("你输入的是"+chi+"尺"+cun+"寸");
// result = ((chi+cun)/12.0)*0.3048;
// System.out.println("换算国内身高为:"+((chi+cun/12.0)*0.3048));
}变量
}float
import java.util.Scanner;程序
public class test1 {
public static void main(String[] args) {
// TODO Auto-generated method stub
int chi;
int cun;
System.out.print("国外身高换算国内身高");
Scanner in = new Scanner(System.in);
System.out.print("请输入的你的英尺数:");
chi = in.nextInt();
System.out.print("请输入你的英寸数:");
cun = in.nextInt();
System.out.println("你输入的是"+chi+"尺"+cun+"寸");
System.out.println("换算国内身高为:"+((int)(((chi+cun/12.0)*0.3048)*100))+"厘米");
}
}
小程序