这里是没有问题如何解决我的解决方案的代码,当它运行作为JUnit测试
public boolean hasAdjacentRepeats(String s){
for(int i = 0; i<s.length(); i++){
if(s.charAt(i) == s.charAt(i + 1)){
return true;
}
}
return false;
}
我的解决方案的代码,但在我的解决方案的代码它像
@Test public void tests6(){
code.Solution s = new code.Solution();
String input = "hhhhhey ";
int expected = true;
int actual = s.hasAdjacentRepeats(input);
assertTrue("Expected was" +true+"but the actual was" +false , expected == actual);
}
第一个错误是真实的。 eclipse显示预期为布尔型的更改类型 第二个错误是int actual = s.hasAdjacentRepeats(input)
与上述问题相同。
所以我不知道修复我的解决方案代码的适当方式是什么。
你知道什么是'int'意思? – immibis 2015-02-08 06:23:30