我將製作一個應用程序,將輸入的單詞的首字母加蓋。我沒有收到任何錯誤,我只是沒有得到任何繼續運行的東西。我怎樣才能得到3個字的第一個字母?
package threeletteracronym;
import java.util.Scanner;
/**
*
* @author Matthew
*/
public class ThreeLetterAcronym {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
String s;
Scanner keyboard = new Scanner(System.in);
System.out.println("Please enter words.");
s = keyboard.nextLine();
char a = keyboard.next().charAt(0);
a = Character.toUpperCase(a);
char b = keyboard.next().charAt(0);
b = Character.toUpperCase(a);
char c = keyboard.next().charAt(0);
c = Character.toUpperCase(a);
System.out.println("Your new Acronym form " + s + " is " + a + b + c);
}
}
我假設這與'javascript'無關。 –