java技術博客

          jsp博客
          數據加載中……
          java中的printf
          public class TestPrintf{
              
          public static void main(String args[]){
                  System.out.printf(
          "%+8.3f",3.14);    
                  System.out.println();            
                  System.out.printf(
          "%+-8.3f\n",3.14);
                  System.out.printf(
          "%08.3f\n",3.14);
                  System.out.printf(
          "%(8.3f\n",-3.14);
                  System.out.printf(
          "%,f\n",2356.34);
                  System.out.printf(
          "%x\n",0x4a3b);
                  System.out.printf(
          "%#x\n",0x4a3b);        
                  System.out.println(
          "------------");    
                  System.out.printf(
          "你好:%s,%3d歲,工資%-7.2f\n","張三",38,15000.00);        
                  System.out.printf(
          "你好:%1$s,%2$3d歲,%2$#x歲\n","張三",38);        
                  System.out.printf(
          "%3d,%#<x",38);
              }
              
          }

          posted on 2008-11-13 09:09 郭興華 閱讀(385) 評論(0)  編輯  收藏


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 成武县| 焦作市| 新化县| 玉田县| 遵义县| 陆丰市| 宣化县| 龙泉市| 涪陵区| 洛扎县| 宜兰市| 板桥市| 石河子市| 昭苏县| 汽车| 邳州市| 黑龙江省| 阳城县| 湖州市| 黄山市| 秀山| 威远县| 奉化市| 衡水市| 乃东县| 漳浦县| 大埔区| 连城县| 托克逊县| 连江县| 武功县| 克东县| 鄄城县| 霸州市| 黄石市| 兴业县| 太白县| 墨竹工卡县| 罗江县| 基隆市| 南郑县|