找出字符串中第一个不重复的字符
chatAt(i) //获取索引i处的字符
indexOf(char) //从前往后数,该字符的索引
lastIndexOf(char) //从后往前数,该字符的索引
public class Main7 {
public static void main(String[] args) {
String str = "abbcda";
char ch;
int start, end;
for(int i=0; i<str.length(); i++) {
ch = str.charAt(i);
start = str.indexOf(ch);
end = str.lastIndexOf(ch);
if(start == end) {
System.out.println(ch);
break;
}
}
}
}