JAVA编程--------------32、取一个整数的4-7位

 1 package FushiExam;
 2 import java.util.*;
 3 public class Text_32 {
 4 
 5     public static void main(String[] args) {
 6         // 取一个整数a从右端开始的4~7位
 7         Scanner scan=new Scanner(System.in);
 8         String str=scan.nextLine();
 9         if(str.length()<7)
10             System.out.println("data error");
11         else
12         {
13         char[] arr=str.toCharArray();
14         for(int i=3;i<7;i++) {
15             System.out.print(arr[i]);
16             }
17         }
18 
19     }
20 
21 }

猜你喜欢

转载自www.cnblogs.com/fmust/p/12515866.html
今日推荐