JAVA编程------------38、写一个函数,求一个字符串的长度,在main函数中输入字符串,并输出其长度

 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 }
原文地址:https://www.cnblogs.com/fmust/p/12532372.html