pullupmethod.java

来自「emacs的一个非常有用的插件,叫xrefactory,可以实现source i」· Java 代码 · 共 40 行

JAVA
40
字号
package com.xrefactory.refactorings;/*  1.)   Put  cursor inside  PullUpMethod  class  and  invoke 'Xref  ->  Refactor'. Select 'Set Target  for Next Moving Refactoring' from the  proposed menu.  2.)  Move  cursor onto  the definition of  the method to  move (onto  'method' name), invoke 'Xref ->  Refactor' once more time and select  'Pull Up Method'.*/class PullUpMethod {    int x = 0;    int y = 0;    // set target here:}class InferClass extends PullUpMethod {    int y = 1;    // put cursor on 'method' name    void method() {        System.out.println("x == " + x);        System.out.println("this.x == " + this.x);        System.out.println("this.y == " + this.y);        System.out.println("super.y == " + super.y);    }    public static void main(String args[]) {        (new InferClass()).method();    }}/*  F5 will bring you back to Index*/

⌨️ 快捷键说明

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