概述
System是System类
1 package java.lang; 2 public final class System { 3 public final static PrintStream out = null; 4 }
println()是PrintStream 类中的方法。
package java.io; public class PrintStream extends FilterOutputStream implements Appendable, Closeable {
protected OutputStream out;
private BufferedWriter textOut;
private void ensureOpen() throws IOException {
if (out == null)
throw new IOException("Stream closed");
}
public void println() { newLine();//换行 } public void println(boolean x) { synchronized (this) { print(x); newLine(); } } public void println(String x) { synchronized (this) { print(x); newLine(); } } public void print(boolean b) { write(b ? "true" : "false"); } public void print(Object obj) { write(String.valueOf(obj)); } 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; } } private void newLine() { try { synchronized (this) { ensureOpen(); textOut.newLine(); textOut.flushBuffer(); charOut.flushBuffer(); if (autoFlush) out.flush(); } } catch (InterruptedIOException x) { Thread.currentThread().interrupt(); } catch (IOException x) { trouble = true; } } }
转载于:https://www.cnblogs.com/stujike/p/9688054.html
最后
以上就是活泼大雁为你收集整理的System.out.println()的详解的全部内容,希望文章能够帮你解决System.out.println()的详解所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复