📜  控制语句 - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:32.343000             🧑  作者: Mango

代码示例1
/**  * @author Java Jill  * @version 1.0*/public class IfExample1 {  public static void main(String[] args) {   try {    String s1 = args[0];    System.out.println("Your guess was: + s1);    if(s1.equals("red")) {     System.out.println("Your guess is my favorite color!");     System.out.println("Good job");   } catch (Exception e) {    System.out.println("Error - please include an argument");   } }}