idea實用的快捷鍵和一些騷操作


快捷鍵

public class Shortcut {
    String name;

    // alt + Insert 
    // 自動生成構造器,set、get等

    // psvm
    public static void main(String[] args) {
        int i = 10;
        int arr = {1, 2, 3, 4, 5};

        // i.sout 或 sout + i
        System.out.println(i);

        // new Shortcut() + alt + enter,引入局部變量
        Shortcut shortcut = new Shortcut();

        // shortcut.name.sout
        System.out.println(shortcut.name);
        
        // 100.for
        for (int i = 0; i < 100; i++) {

        }

        // arr.for
        for (int i : arr) {

        }

        // fori
        for (int i = 0; i < ; i++) {
            
        }

        // foreach
        for (:
             ) {
            
        }
        
        /*
        1、Ctrl + Enter:在下方新建行但不移動光標

        2、Shift + Enter:在下方新建行並移動光標到新行行首

        3、Ctrl + /:注釋(取消注釋)選擇的行

        4、Ctrl + D:對光標所在行的代碼進行復制

        5、Ctrl + Y 快速刪除光標所在行

        6、Ctrl + Alt + L 規范代碼

        7、Alt + Enter 引入局部變量

        8、Ctrl + Alt + ← 回到上一次編輯的光標處 
        */
    }
}

alt + Insert

ctrl + H

ctrl + alt + t

shift + shift

shift + F9 調試
shift + F10 運行
crtl + F5 重新運行

騷操作

  • 反編譯
    將class文件直接拖到包里

  • 源碼
package com.crazygod.struct;

public class Demo01 {

    public static void main(String[] args) {
        String name = "仇";

        // JDK7的新特性,表達式結果可以是字符串
        // 字符的本質還是數字

        // 反編譯 java---class(字節碼文件)—---反編譯(idea)

        switch (name) {
            case "仇":
                System.out.println("仇");
                break;
            case "Crazy":
                System.out.println("Crazy");
                break;
            default:
                System.out.println("Fuck!");
        }
    }
}
  • class文件反編譯
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.crazygod.struct;

public class Demo01 {
    public Demo01() {
    }

    public static void main(String[] args) {
        String name = "仇";
        byte var3 = -1;
        switch(name.hashCode()) {
        case 20167:
            if (name.equals("仇")) {
                var3 = 0;
            }
            break;
        case 65369201:
            if (name.equals("Crazy")) {
                var3 = 1;
            }
        }

        switch(var3) {
        case 0:
            System.out.println("仇");
            break;
        case 1:
            System.out.println("Crazy");
            break;
        default:
            System.out.println("Fuck!");
        }

    }
}
  • 通過Structure查看類的結構,在學習java新類的功能時特別適用
    比如學習Java的工具類Arrays

注釋顏色

RGB:100, 26, 255

查看接口實現類

編輯區背景顏色恢復


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM