eclipse添加注释的快捷方法

1.多个单行注释 :

选中要添加的代码,按  Ctrl+/  添加完毕后如图

    // @Test
    // public void connectMongodb() {
    // try {
    // // 连接到 mongodb 服务
    // MongoClient mongoClient = new MongoClient("localhost", 27017);
    // // 连接到数据库
    // MongoDatabase db = mongoClient.getDatabase("test");
    // System.out.println("Connect to database successfully");
    // db.createCollection("test");
    // System.out.println("集合创建成功");
    // } catch (Exception e) {
    // System.err.println(e.getClass().getName() + ": " + e.getMessage());
    // }
    // }

2.Javadoc 注释:

 在方法名和类之前 按Alt+Shift+J 可以添加

/**
 * @author Administrator
 * @date 2017-07-28
 *
 */
public class TestMistake {

}

3.多行注释 :

 选中要注释的代码,Ctrl+Shift+/,去除注释的快捷键是Ctrl+Shift+

  /*  @Test
    public void connectMongodb() {
        try {
            // 连接到 mongodb 服务
            MongoClient mongoClient = new MongoClient("localhost", 27017);
            // 连接到数据库
            MongoDatabase db = mongoClient.getDatabase("test");
            System.out.println("Connect to database successfully");
            db.createCollection("test");
            System.out.println("集合创建成功");
        } catch (Exception e) {
            System.err.println(e.getClass().getName() + ": " + e.getMessage());
        }
    }*/
Ride the wave as long as it will take you.
原文地址:https://www.cnblogs.com/jianpanaq/p/7249815.html