私は文字を昇順または昇順で表示したいと考えています。配列のインデックスを比較するのに問題があります。この場合、私はバブルソート技術を使用して、それらを変更しています。Javaで昇順に文字を表示
public class Main
{
public static void main(String[] args)
{
System.out.print("#Enter text : ");
String text = BIO.getString();
while (! text.equals("END"))
{
boolean inorder = false;
// Convert the above string to a char array.
char[] arr = text.toCharArray();
for (int i=0; i<arr.length-1; i++)
{ //Check pair
if (arr[i] > arr[i+1])
{
System.out.print("letters in ascending order");
inorder = true;
}
}
if (! inorder)
{
System.out.print("letters not in ascending order");
}
break;
}
}
}
あなたの質問は何ですか?あなたの解決策は正しいと思われる。 – belgther
楽しい事実として、[Aegilops](http://en.wikipedia.org/wiki/Aegilops)は、[最長の単語](http://en.wikipedia.org/wiki/Longest_word_in_English#Words_with_certain_characteristics_of_notable_length)です。アルファベット順。 – JRL