⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 iftest.java

📁 《Java核心技术应用开发》电子工业出版社书籍源代码
💻 JAVA
字号:
/**
 * 演示If的使用
 *
 */

package sample;

public class IfTest {
    
   public void judge(int i){
       int sw = 0;
       if(i > 0) sw = 1;
       else if( i < 0) sw = -1;
       
       switch(sw) {
           case 1:
                System.out.println("i is a positive number");
                break;
           case 0:
                System.out.println("i is zero");
                break;
           case -1:     
                System.out.println("i is a negative number");
                break;
       }
   }
    
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        IfTest it = new IfTest();
        it.judge(10);
        it.judge(0);
        it.judge(-2);
    }
    
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -