作者ayaniji ( ̄▽ ̄b)
看板java
标题[问题] 请教一下
时间Thu Oct 16 02:27:04 2014
不好意思~请问关於下面的程式一些问题
--------------------------------------
//呼叫util套件
import java.util.*;
public class bmi {
public static void main(String[]args)throws java.io.IOException
{
//宣告区域变数 体重w为常数 bmi和身高为变数
int w=0;
double bmi=0,h=0;
//建立Scanner物件
Scanner sc=new Scanner(System.in);
System.out.print("请输入体重");
w=sc.nextInt();
System.out.print("请输入身高");
h=sc.nextInt();
//mbi公式
h=h/100;
h=h*h;
bmi=w/h;
//列印结果并显示与萤幕上
System.out.println("bmi="+bmi);
}
}
----------------------------------------------
1.public static void main(String[]args)後面的throws java.io.IOException
2.Scanner sc=new Scanner(System.in)
3.w=sc.nextInt();
想请教上面几个语法的用法意思
麻烦指点一下新手~谢谢Orz
--
自分を幸せにできるのは自分だけだから。
楽しくなければ生きている意味が无いし!
╭/\☆────/\╮ ╭/\─────/\╮│ │ │ \ / │
│ 喵 喵 │ │ 喵 喵 │
│○ ╰───╯ ○│ │〃 ╰┬┬┬╯ 〃│ │ │ ╰─╯ │
╰─┬O───O┬─╯ ╰─┬○───○┬─╯
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 118.167.154.68
※ 文章网址: http://webptt.com/cn.aspx?n=bbs/java/M.1413397627.A.1FA.html
1F:→ fireslayer: 你应该先google 10/16 02:59
2F:推 fireslayer: key word: Scanner , Exception Handling 10/16 03:03
3F:推 LPH66: 你这段程式码哪里看来的, 去那个地方找一定有解说 10/16 04:05