example.java
来自「这个工具用于对JAVA的类文件进行覆盖率的测试」· Java 代码 · 共 51 行
JAVA
51 行
package org.hanselexample;/** * Example class that is tested by the ExampleTest class. * This implements two methods and has one inner class. * * @author Niklas Mehner */public class Example { /** * The method returns the absolute value of an int. * @param i Int. * @return Absolute value of i. */ public int abs(int i) { if (i > 0) { return i; } else { return -i; } } /** * This method returns the sum of two numbers. * @param a First addend. * @param b Second addend. * @return Sum of a and b. */ public int add(int a, int b) { return new ExampleInner().add(a, b); } /** * The add method delegates the call to this class to * test the coverage of inner classes. */ private class ExampleInner { /** * This method returns the sum of two numbers. * @param a First addend. * @param b Second addend. * @return Sum of a and b. */ public int add(int a, int b) { return a + b; } }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?