集册 Java实例教程 使用b,B,h,H,%和n转换字符。

使用b,B,h,H,%和n转换字符。

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

582
提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
使用b,B,h,H,%和n转换字符。



public class Main /*from 时代Java - nowjava.com*/

{

   public static void main(String[] args) 

   {

      Object test = null;

      System.out.printf("%b\n", false);

      System.out.printf("%b\n", true);

      System.out.printf("%b\n", "Test");

      System.out.printf("%B\n", test);

      System.out.printf("Hashcode of \"hello\" is %h\n", "hello");

      System.out.printf("Hashcode of \"Hello\" is %h\n", "Hello");

      System.out.printf("Hashcode of null is %H\n", test);

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