I am wondering about the the following piece of Java code:
“System.out.println”. I am right about this:
“System” is a static class. “.out” is a method of class “System”. This is the bit I am slighty confused about “.println”– what class / object is this a method of?
Also, is this concept known as “method chaining”?
Thanks
GF
No, it’s not method chaining. You’re right about
Systembeing a class (just a regular class, not “static” – only inner classes can be static), butoutis a static field of the class (of the type java.io.PrintStream), and onlyprintln()is a method ofPrintStream.This is an example of method chaining: