Does the System.out object belong to class System

2019-02-18 16:20发布

I'm new to programming and I just started learning Java. I'm curious that does the object System.out belong to class System or class PrintStream?

I referred to a textbook, JAVA CONCEPTS 4/e. The textbook states that to use the out object in the System class, you must refer it as System.out but later in the book it states that the System.out belongs to class PrintStream.

I've searched google and stackoverflow but all the answers are too hard for me to understand.

7条回答
戒情不戒烟
2楼-- · 2019-02-18 16:57

It is defined as:

static PrintStream  out 
查看更多
Juvenile、少年°
3楼-- · 2019-02-18 16:59

"out" belongs to class "System" and is of type "PrintStream" :)

查看更多
戒情不戒烟
4楼-- · 2019-02-18 17:02

System.out is a PrintStream object. It is defined in System (so, it is member of System) class as :

static PrintStream out

See: http://docs.oracle.com/javase/6/docs/api/java/lang/System.html

查看更多
三岁会撩人
5楼-- · 2019-02-18 17:06

out is a static field in System. Its type is PrintStream.

查看更多
一纸荒年 Trace。
6楼-- · 2019-02-18 17:10

In loose simple terms, 'out' is a field (i.e. an object) in class 'System' of type 'PrintStream'.

查看更多
Summer. ? 凉城
7楼-- · 2019-02-18 17:10

Out is the static reference variable in class System and is of PrintStream(class) type.

查看更多
登录 后发表回答