public class HelloWorld { public static void main(String[] args) { int age=25; String s = (age>=18)?"成年":"未成年"; System.out.println(s); } }
public class HelloWorld {
??? public static void main(String[] args) {
?? ??? ?int age=25;
?? ??? ?
?????? ?
??????? String s = (age>=18)?"成年":"未成年";
?????? ?
?????? ?
??????? System.out.println(s);
?????? ?
?????? ?
?? ?}
}
2017-01-14
人家讓你用if,else來做這個題,你弄個三元運算。
2016-11-21
我運行了一下,沒問題啊
2016-10-07