Java基础 println 输出常量的示例
生活随笔
收集整理的這篇文章主要介紹了
Java基础 println 输出常量的示例
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
- ????JDK :OpenJDK-11
- ?????OS :CentOS 7.6.1810
- ?????IDE :Eclipse 2019?03
- typesetting :Markdown
?
code
package per.jizuiku.base;/*** @author 給最苦* @date 2019/06/29* @blog www.cnblogs.com/jizuiku*/ class Demo {/*** @param args*/public static void main(String[] args) {// 輸出常量System.out.println("hello");// 字符串System.out.println(100);// 整數(shù)System.out.println(11.1);// 小數(shù)System.out.println('a');// 字符System.out.println(true);// 布爾常量System.out.println(false);// System.out.println(null);// 上面一行代碼在輸出的時(shí)候出現(xiàn)錯(cuò)誤// 提示:對println的引用不明確。} }?
result
hello 100 11.1 a true false?
sourceCode
/*** Prints a boolean and then terminate the line. This method behaves as* though it invokes {@link #print(boolean)} and then* {@link #println()}.** @param x The {@code boolean} to be printed*/ public void println(boolean x) {synchronized (this) {print(x);newLine();} } /*** Prints a boolean value. The string produced by {@link* java.lang.String#valueOf(boolean)} is translated into bytes* according to the platform's default character encoding, and these bytes* are written in exactly the manner of the* {@link #write(int)} method.** @param b The {@code boolean} to be printed*/ public void print(boolean b) {write(String.valueOf(b)); } private void write(String s) {try {synchronized (this) {ensureOpen();textOut.write(s);textOut.flushBuffer();charOut.flushBuffer();if (autoFlush && (s.indexOf('\n') >= 0))out.flush();}}catch (InterruptedIOException x) {Thread.currentThread().interrupt();}catch (IOException x) {trouble = true;} }?
resource
- [ JDK ] openjdk.java.net
- [ doc - 參考 ] docs.oracle.com/en/java/javase/11
- [ 規(guī)范 - 推薦 ] yq.aliyun.com/articles/69327
- [ 規(guī)范 - 推薦 ] google.github.io/styleguide
- [ 源碼 ] hg.openjdk.java.net
- [ OS ] www.centos.org
- [ IDE ] www.eclipse.org/downloads/packages
- [ 平臺(tái) ] www.cnblogs.com
?
感謝幫助過 給最苦 的人們。
Java、Groovy和Scala等基于JVM的語言,優(yōu)秀,值得學(xué)習(xí)。
規(guī)范的命名和代碼格式等,有助于溝通和理解。
JVM的配置、監(jiān)控與優(yōu)化,比較實(shí)用,值得學(xué)習(xí)。
轉(zhuǎn)載于:https://www.cnblogs.com/jizuiku/p/11107748.html
總結(jié)
以上是生活随笔為你收集整理的Java基础 println 输出常量的示例的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: MYSQLl数据库 表的操作
- 下一篇: ADSL pppoe 拔号工具rp-pp