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 }

 

posted @ 2020-03-20 16:09  Hey蜗牛  阅读(1589)  评论(0编辑  收藏  举报