package com.my.demo; import java.util.Scanner; public class Test1 { public static void main(String[] args){ Scanner sc=new Scanner(System.in); System.out.println("请输入一串字母:"); String line=sc.nextLine(); char[] arr=line.toCharArray(); for(int i=0;i<arr.length;i++){ char temp; if (arr[i]>=97 && arr[i]<=122){ arr[i]= (char)(arr[i]-32); } } for (char a:arr){ System.out.print(a); } } }