java Justin.java

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了java Justin.java相关的知识,希望对你有一定的参考价值。

import java.util.Scanner;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;

public class justin {

    public static void main(String[] args) {
        //Input String
        String s = "Welcome to hell";
        //Final String
        StringBuilder result = new StringBuilder();
        //
        char arr[] = s.toCharArray();
        //Itterate over CharArray 
        for (int i = 0; i < arr.length; i++) {
            //Cast to int to get ASCII value
            int CharToASCII = (int) arr[i] + 1;
            //Cast int back to char
            char ASCIIToChar = (char) CharToASCII;
            //Append chars converted to strings to final String
            result.append(Character.toString(ASCIIToChar));
        }
        //Print Final String
        System.out.println(result);

    }
}

以上是关于java Justin.java的主要内容,如果未能解决你的问题,请参考以下文章

Java Math

Java 布尔运算

java [Java] Java常用代码#java

Java - 35 Java 实例

Java While 循环

Java 字符串