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); } } }
原文地址:https://www.cnblogs.com/-yyk/p/10785551.html
时间: 2024-11-08 15:24:00