本帖最后由 潘际昌 于 2013-11-27 17:21 编辑
- </blockquote></div><div class="blockcode"><blockquote>import java.io.*;
- import java.util.*;
- public class Test8
- {
- public static void main(String[] args) throws Exception{
- // TODO Auto-generated method stub
- BufferedReader bufr= new BufferedReader(new InputStreamReader((System.in)));
- BufferedWriter pt=new BufferedWriter(new OutputStreamWriter(System.out));
- String s=null;
- while((s=bufr.readLine())!=null)
- {
- char[] ch=s.toCharArray();
- for(int x=0;x<ch.length;x++)
- {
- if(ch[x]>='a'&&ch[x]<='z')
- {
- ch[x]=Character.toUpperCase(ch[x]);
- }
- else if(ch[x]>='A'&&ch[x]<='Z')
- {
- ch[x]=Character.toLowerCase(ch[x]);
- }
- else
- continue;
- }
-
-
- String s1=Arrays.toString(ch);//为什么这句话没什么用?打印的还是数组。
- pt.write(s1, 0, s1.length());
- pt.flush();
- }
- bufr.close();
- pt.close();
- }
-
- }
复制代码
|