Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/332.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 我得到一个错误;方法NewTime(int,int)对于类型NewTime";_Java_Eclipse - Fatal编程技术网

Java 我得到一个错误;方法NewTime(int,int)对于类型NewTime";

Java 我得到一个错误;方法NewTime(int,int)对于类型NewTime";,java,eclipse,Java,Eclipse,在下面的代码中,一旦达到T2.NewTime,就会出现错误 public class NewTimeJUnitTest { @Test public void testNewTime() // This runs the test using invalid hour value, and valid hour value. { NewTime T2 = new NewTime(16, 30); // This contains an inval

在下面的代码中,一旦达到T2.NewTime,就会出现错误

public class NewTimeJUnitTest {

  @Test
  public void testNewTime() // This runs the test using invalid hour value, and valid hour value.
  {
    NewTime T2 = new NewTime(16, 30);               // This contains an invalid value as the minutes. Which leads to the result being invalid.
    T2.subtractTime(03, 00);

    boolean actual = T2.NewTime (hh, mm);
    boolean expected = true;
    assertEquals(expected, actual);
  }
}

如果调用,构造函数NewTime没有任何匹配的参数。

类NewTime中没有接受(int,int)或(Integer,Integer)的构造函数。只需将错误的参数传递给NewTime.NB的构造函数:不要在时间组件前面加零前缀,如
00
03
。它导致int文本以八进制进行解释,这意味着您无法写入
08
09