集册 Java实例教程 小写/大写和字符的ASCII码

小写/大写和字符的ASCII码

欢马劈雪     最近更新时间:2020-01-02 10:19:05

445
提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
小写/大写和字符的ASCII码

public class Main {
/**
来 自 n o w j a v a . c o m
**/


  public static void main(String[] args) {

    char c1, c2;

    c1 = 'a';

    c2 = 'z';

    // Compare character code

    if (c1 < c2) {

      System.out.println(c1 + " is before " + c2);

    } else {

      System.out.println(c1 + " is after or equal to " + c2);

    }/*nowjava 提供*/

    int codec1 = c1; // type casting/conversion

    int codec2 = c2; // type casting conversion

    System.out.println(
展开阅读全文