@Test无法运行

使用@Test需要导入两个依赖

junit-4.12.jar
hamcrest-core-1.3.jar

添加@Test注解,却没有运行的三角形。需要在该类和方法上都加一个public

public class Solution {
    @Test
    public void test(){
        int[] nums ={2,7,11,15};
        System.out.println(twoSum(nums,9));
......   

参考链接:
https://www.pianshen.com/article/6089909307/

posted @ 2021-02-07 14:00  DJ同学  阅读(638)  评论(0编辑  收藏  举报