码迷,mamicode.com
首页 > 其他好文 > 详细

字符串加密

时间:2015-10-24 20:08:27      阅读:102      评论:0      收藏:0      [点我收藏+]

标签:

package com;

import java.util.Scanner;

public class Secert {

 

public static void main(String[] args) {

Scanner input = new Scanner(System.in);

System.out.println("请输入一个大写的英文字符串:");

String aaa = input.nextLine();

System.out.println("该英文字符加密后为:");

for(int i =0;i<aaa.length();i++)

{

char ch = aaa.charAt(i);

if(ch==‘X‘)

{

System.out.print(‘A‘);

 

}

else if(ch==‘Y‘)

{

System.out.print(‘B‘);

 

}

else if(ch==‘Z‘)

{

System.out.print(‘C‘);

}

else

System.out.println((char)(ch+3));

}

 

}

 

}

 技术分享

 

字符串加密

标签:

原文地址:http://www.cnblogs.com/meng-1204/p/4907341.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!