-9
它說「不兼容的類型:字符串不能轉換爲字符」 如何解決它? 這裏是例子。 字符串不能轉換爲字符,如何解決它?
它說「不兼容的類型:字符串不能轉換爲字符」 如何解決它? 這裏是例子。 字符串不能轉換爲字符,如何解決它?
這是您的解決方案:
public class NewMain {
public static void main(String args[]) throws ParseException {
Scanner s = new Scanner(System.in);
char yes;
do {
System.out.println("Hi");
yes = s.next().charAt(0);
} while (yes == 'Y'); // if u enter 'Y' the it will continue
}
}
要退出進入其他任何東西,然後'Y'
好的,謝謝 –
宣佈你們CHAR是作爲字符串。 –
我強烈建議您先閱讀基礎知識 –
如何將其聲明爲字符串?我是初學者 –