1 package FushiExam; 2 import java.util.*; 3 public class Text_38 { 4 5 public static void main(String[] args) { 6 //寫一個函數,求一個字符串的長度,在main函數中輸入字符串,並輸出其長度 7 Scanner scan=new Scanner(System.in); 8 String str=scan.next();//輸入字符串 9 System.out.println(str.length()); 10 11 12 } 13 14 }
