我必须创建一个程序来返回下一个非重复字符..
ex我给...tweet
它应该将输出返回为w
...
public class str_next {
public static void main(String args[]) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter the string");
String s = br.readLine();
revString(s);
}
static char revString(String str) {
int i = 0;
int j;
int n = str.length();
for (i = 0; i < n; i++) {
for (j = i + 1; j < n; j++) {
char c = str.charAt(i);
char d = str.charAt(j);
if (c != d) {
System.out.print(d);
}
}
}
}
}
我收到错误,因为..缺少返回语句..
谁能告诉我..我该如何解决这样的问题..我错在哪里..?