当前位置:网站首页>Today will finally write system out. Println()
Today will finally write system out. Println()
2022-04-23 01:55:00 【Sivan_ Xin】
List of articles
I've been sorting out IO When streaming notes , We found such a problem ······
understand System.out.println()
stay Java.lang There is a System class , It defines a class ( static state ) Member variables :
public final static PrintStream out = null;
thus it can be seen ,out nothing but PrintStream An object of . because out stay System Class is statically decorated , So you can call... Directly through the class name System.out
.(System.in It's the same thing , I won't go into details here .)
Now? , We got PrintStream An object of class System.out
, Calling methods through objects (println) It's better to understand , So you get this statement System.out.println
.
// Generally, no one will write like this , It's just easy to understand .
PrintStream Myout = System.out;
Myout.println("Sivan");
Null pointer out
here out As an object but declared as null. But why not throw NullPointerException?
Because in System Class has a static initialization block :
/* register the natives via the static initializer. * * VM will invoke the initializeSystemClass method to complete * the initialization for this class separated from clinit. * Note that to use properties set by the VM, see the constraints * described in the initializeSystemClass method. */
private static native void registerNatives();
static {
registerNatives();
}
JVM When loading a class , It is through registerNatives()
This static method gives out Given the initial value , As for the specific operation , You can refer to this article :https://zhidao.baidu.com/question/38660871.html.
thus it can be seen ,Java All things are objects .
The most important thing is coming ~~~
It's not easy to code words , Ask for attention
Order a collection and don't get lost ~
版权声明
本文为[Sivan_ Xin]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230154527475.html
边栏推荐
- Do447 manage user and team access
- What code needs unit testing?
- [Leetcode每日一题]396. 旋转函数
- 一些使用代理IP的小技巧。
- Under the pressure of sales, domestic mobile phones began to reduce prices, but they haven't put down their final face
- 什么是布尔类型?
- Sqlserver data transfer to MySQL
- NPM -- configure Taobao image
- Tight coupling of visual wheel odometer
- W801 / w800 WiFi socket development (I) - UDP
猜你喜欢
搭建网站是用物理机还是云主机好?
Virtual serial port function of j-link V9 using skills
C语言中如何“指名道姓”的进行初始化
如何设置电脑ip?
有哪些业务会用到物理服务器?
Esp32 message queue using FreeRTOS
Communication summary between MCU and 4G module (EC20)
Problem solving: dpkg DEB: error: package name has characters that are't lowercase alphanums or '- +‘
What is a dial-up server and what is its use?
W801/W800-wifi-socket开发(二)-UDP蓝牙控制wifi连接
随机推荐
Leetcode-阶乘函数后 K 个零
什么时候应该编写单元测试?什么是TDD?
What problems will you encounter when dialing VPS?
Batch multiple files into one hex
Nanny level tutorial on building personal home page (II)
K zeros after leetcode factorial function
Shardingsphere introduction and sub table usage
CC2541的仿真器CC Debugger使用教程
Solve the problem when installing MySQL
一些使用代理IP的小技巧。
Error in face detection and signature of Tencent cloud interface
Uncover floating-point operations hidden by the ARM compiler
42、使用mmrotate中k3det进行旋转目标检测,并进行mnn部署和ncnn部署
Use Xdebug breakpoint debugging in postman
拨号服务器是什么,有什么用处?
动态代理ip的测试步骤有哪些?
[经验教程]支付宝余额自动转入余额宝怎么设置关闭取消支付宝余额自动转入余额宝?
如何设置电脑ip?
哪些代码需要做单元测试?
keil mdk中文乱码,两种解决方法,字体不再难看