Blogger Information
Blog 75
fans 0
comment 0
visits 55211
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
小猿圈java之ascii码值转为输出ascii码
聆听的博客
Original
577 people have browsed it

在学习java的过程中,都会到编码转换问题,那么ascii码值怎么输出ascii码呢,其实这是java的一个小技巧,挺简单的,你在面试的时候有可能会遇到,下面咱们一起来看一下吧,希望小猿圈加加的这个小技巧能帮到你。

实例

public static void main(String[] args) {
        // TODO Auto-generated method stub
        String a = "\001";
        if("\001".equals(a)){
            a = "001";
            int b = Integer.valueOf(a);
            //转为ascii
            char c = (char)b;
            //转为String
            String d = String.valueOf(c);
            System.out.println(">>>>>>c:"+c);
            System.out.println(">>>>>>d:"+d);
        }
    }

运行实例 »

这个小技巧很有价值吧,简简单单几行代码,希望大家可以记住,以免越小的知识点越容易忽视,小猿圈分享这篇文章就到这里了,感觉不错的可以看一下小编前几篇文章,有很多这种小的技巧。

Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post