Mandatory Convert String A simple way (notes)

xiaoxiao2021-03-06  14

Mandatory Convert String A simple way (notes)

// 05 EG.

//: c05: Tooltest.java// from 'Thinking in java, 2nd Ed.' by bra buce eckel // www.bruceeckel.com. See Copyright Notice In Copyright.txt.// Uses the Tools Library.Import com.bruceeckel .tools. *;

Public class tooltest {public static void main (string [] args) {p.rintln ("Available from now!"); p.rintln (" 100); // force it to be a string p.rintln "" 100L); p.rintln ("" 3.14159);}} ///

The "" empty string is added in front of the variable. Or put the variables in the string expression, you can force the conversion.

转载请注明原文地址:https://www.9cbs.com/read-49669.html

New Post(0)