Java输入一个字母,输出其前后的字母
import java.util.*;
class Test{
public static void main(String[] args)
{
Scanner x=new Scanner(System.in);
char a=x.nextchar();
if(a>='a'&&a<'z')
System.out.print(a-1);
System.out.print(a);
System.out.print(a+1);
else if(a=='z')
System.out.print(a-1);
System.out.print(a);
System.out.print("a");
if(a>='A'&&a<'Z')
System.out.print(a-1);
System.out.print(a);
System.out.print(a+1);
else if(a=='Z')
System.out.print(a-1);
System.out.print(a);
System.out.print("A");
else
System.out.println("输入不正确");
}
}