没有值的json字符串_Java中具有原始数据类型值的字符串连接
沒有值的json字符串
Given a string and some of the primitive data type values, we have to concatenate them with the string in Java.
給定一個字符串和一些原始數據類型值,我們必須將它們與Java中的字符串連接起來。
In the example below, we have declared and initialized some of the primitive type of objects and a string object; we are adding the value of primitive types in the string object and printing the values of the result.
在下面的示例中,我們聲明并初始化了一些原始類型的對象和一個字符串對象; 我們將在字符串對象中添加基本??類型的值并打印結果的值 。
帶有原始數據類型值的字符串連接的Java代碼 (Java code for string concatenation with primitive data type values)
// Java code for string concatenation with // primitive data type valuespublic class Main {public static void main(String[] args) {boolean isMarried = false;boolean isQualified = true;int age = 21;double weight = 67.85;char gender = 'M';String name = "Shivang Yadav";String result = null;result = "isMarried: " + isMarried;System.out.println(result);result = "isQualified: " + isQualified;System.out.println(result);result = name + " is " + age + " years old.";System.out.println(result);result = name + " weight is " + weight + " kg.";System.out.println(result);result = "His gender is: " + gender;System.out.println(result);} }Output
輸出量
isMarried: false isQualified: true Shivang Yadav is 21 years old. Shivang Yadav weight is 67.85 kg. His gender is: M翻譯自: https://www.includehelp.com/java-programs/string-concatenation-with-primitive-data-type-values-in-java.aspx
沒有值的json字符串
總結
以上是生活随笔為你收集整理的没有值的json字符串_Java中具有原始数据类型值的字符串连接的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 颐和园狗拉雪橇多少钱一次
- 下一篇: 在JavaScript中以日期/月/年格