close
1.結果顯示

-Configuration: --------------------
 man

Process completed.  編譯成功 以下為程式碼
 
public class yr20130725
{
    public static void main(String[] args)
    {
int u=30;
if (u<20)
System.out.println("young man");
else if(u<40)
System.out.println(" man");
else if(u<90)
System.out.println("old man");


    }
}
2.--------------------Configuration: --------------------
young man

Process completed.編譯成功


//use if-else
public class yr20130725_01
{
    public static void main(String[] args)
    {
int u=30;
if (u>90)
System.out.println("older man");
else if(u>40)
System.out.println("man");
else if(u>20)
System.out.println("young man");
else if(u<20)
System.out.println("young boy");


    }
}
arrow
arrow
    全站熱搜

    gtea0609 發表在 痞客邦 留言(0) 人氣()