标题:java 程序求解,求大神们解答
取消只看楼主
guyong131488
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2014-9-11
 问题点数:0 回复次数:0 
java 程序求解,求大神们解答
import java.util.*;

public class CompareString
{
    public static void main(String[] args)
    {
        while (true)        
        {
            Scanner in = new Scanner(System.in);   
            char[] input=in.next().toCharArray();   
            StringBuffer output=new StringBuffer();
            int num=0;
            for(char ch:input)       //这一句是什么意思呢????????????????????????
            {

                if(Character.isUpperCase(ch))      
                {
                    num=ch-'A'+27;
                }
                else
                {
                    num=ch-'a'+1;
                }
                num=(num*num+num+1)%52;
                if(num>26)
                {
                    output.append((char) (num-27+65));   
                }
                else
                {
                    output.append((char) (num+97-1));
                }
            }
            System.out.println(output.toString());  //output已经是字符串了,为什么还要用toString转化成字符串呢????????????????
        }
    }
}


求大神们解答,不甚感激
搜索更多相关主题的帖子: java import public 
2014-10-13 21:04



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-437222-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.073045 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved