Java学习(七):CodeFormat配置,设置Save时自动Format。附Format模板。

时间:2015-04-01 01:45:14   收藏:0   阅读:1744

Eclipse添加codeFormat模板(见附件)。

Windows--Preference--Java--Code Style--Format,   import附件中的模板。

                               --Java--Editor--Save Actions, 勾选Format source code,在编辑保存的时候就会自动format代码。相当方便。

 

格式如下:

/**
 * A sample source file for the code formatter preview
 */

package mypackage;

import java.util.LinkedList;

public class MyIntStack
{
    private final LinkedList fStack;
    
    public MyIntStack()
    {
        fStack = new LinkedList();
    }
    
    public int pop()
    {
        return ((Integer)fStack.removeFirst()).intValue();
    }
    
    public void push(int elem)
    {
        fStack.addFirst(new Integer(elem));
    }
    
    public boolean isEmpty()
    {
        return fStack.isEmpty();
    }
}

 

 

http://files.cnblogs.com/files/moleme/codeformat.rar

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!