Java 我得到一个错误;方法NewTime(int,int)对于类型NewTime";
在下面的代码中,一旦达到T2.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
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
。