字串定義文法

來源:互聯網
上載者:User

標籤:value   字元   you   span   數字轉換   out   sys   string   static   

package com.company;public class Main {    public static void main(String[] args) {        //文法:static String valueOf(args)args任一數字類型或布爾型,String 類型,        String strInt=String.valueOf(126) ;        System.out.println(strInt);        String strLong=String.valueOf(126L) ;        System.out.println(strLong);        String strDouble=String.valueOf(126.3242) ;        System.out.println(strDouble);        String a="1"+2+3+4;//碰到字串後,直接輸出後面的內容        String b=1+2+3+"4";//碰到字串前,先做運算在輸出        String c="1"+(2+3+4);//碰到括弧,先做運算,後輸出        //文法:字串=字串+數字        //列如  String str=""+123;""可以將數字轉換為字串    // write your code here    }}

 

字串定義文法

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.