Just started learning Java, through the "hello world" app, k learned about the object System.out.
Out is an object, but to use it, we have to write system in front of it. It's obvious and my book says that out belongs to system class.
But later in the book, my book says out also belongs to PrintStream class. That is what enable us to use println methods because they both belong to PrintStream class.
I am confused what class does out belong to?
Also, is it just a convention that for objects like out, we have to write the class as well whenever we use it. For something like;
String greeting = "Hello, World!"; If we want to use .length() method which I guess also belongs to string class, we DONT write: int n=String.greeting.length()
Instead, it's just: int n=greeting.();