#Information about the system class

1 messages · Page 1 of 1 (latest)

tame trail
#

Hello is the out object automatically created or is it actually a field confused since I know print, println, printf are methods. Please ping me also if you have an answer.

quick ivyBOT
#

<@&987246399047479336> please have a look, thanks.

quick ivyBOT
#

While you are waiting for getting help, here are some tips to improve your experience:

Code is much easier to read if posted with syntax highlighting and proper formatting.

If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.

Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.

cloud abyss
#

since that's the part which is responsible for talking to the operating system

tame trail
cloud abyss
#

it is an object

#

and a field

#

field is a property of a class, it can be an object or a primitive

tame trail
#

So like
System class
Out field
Out object
Print method
Println method
Printf method

cloud abyss
#

primitives don't have methods, objects do

#

out is a static field of class System which has type PrintStream

#

and the PrintStream class has all those methods

tame trail
cloud abyss
#

it means what kind of class does a variable or a field belong to

#

classes are blueprints for objects

tame trail
#

Yes

cloud abyss
#

you can create onstances of them

tame trail
#

Yes

cloud abyss
#

like for example "foo" is a object of type String

tame trail
#

Yes

cloud abyss
#

public static final String foo = "foo";
here you declare a field foo with type String which refers a string with value "foo"

tame trail
#

Yes

#

PrintStream is a type like String, int, float etc?

cloud abyss
#

yeah

#

it's a class someone wrote

tame trail
#

Alright thanks for explaining

tame trail
cloud abyss
#

what do you mean by "PrintStream type = out"

tame trail
#

It's a type to have the out instance?

#

To then call each of the print methods?

cloud abyss
#

kinda
out is a field that points to an object
and that object is of type PrintStream

tame trail
#

Could you show me in code maybe I'll understand

cloud abyss
#

you can check it out yourself in an IDE

#

java sources are fully available

#

just go to the System class

tame trail
#

Alright I'll look at it

tame trail