我正在编写一种方法来提取某个子字符串,但我在调用该方法时遇到了问题。代码如下:
public void start() {
String inputString = "XOXOXOO X XXO X OXO ";
int row = 0;
int length = inputString.length();
System.out.println("Enter column for X:");
int column = Integer.parseInt(Keyboard.readInput());
}
enterToken("X", inputString,column);
private String enterToken(String tokenSymbol, String inputString, int column){
String columnEdit = inputString.substring(column*6-6,column*6);
String columnEdit1 = columnEdit.trim( );
String columnEdit2 = columnEdit1+tokenSymbol+" ";
String columnEdit3 = columnEdit2.substring(0,6);
System.out.println(columnEdit3);
return columnEdit3;
}
我收到错误“方法声明无效;需要返回类型”。我确信我正确地宣布了它..