+ 3
In System.out.println(); what is out???
Can anybody tell me.... pls anyone accept my challenge
8 Answers
+ 1
"Out"
is a reference variable of prinstream Class.
which is declared as "static "
in System class..
which hold the reference id of object of prinstream class
+ 2
This is the answer of my questions..
thanks..
+ 2
I wrote up some code to show you how you could make your Java "System.out" life a lot easier. Code is below. You can shorten it so that you're not always stuck writing out the entire namespace for simple, most frequently used syntax.
https://code.sololearn.com/cJJXxrsTgvXR/#java
// We'll import this so we don't have to always type System.out
import static java.lang.System.out;
public class Program
{
// Custom function for System.out.println()
public static void println(String string){
System.out.println(string);
}
// Custom function for System.out.print()
public static void print(String string){
System.out.print(string);
}
public static void main(String[] args) {
// Using the import we created at top, shortend to out.println()
out.println("test");
// Using the custom function we created, shortened to println()
println("test2");
// Using the custom function we created, shortened to print()
print("test3");
print("...test4");
}
}
::::: OUTPUT :::::
test
test2
test3...test4
^You can store the custom functions inside of another file and import it into whatever projects you want to use it in. As well, you can rename them to anything you want, and even further, you can create custom features for each or expand the native functions further.
+ 2
Mr Jakob.
I not steal your answer.
what you describe me..
while using static import..
you only prove me right...
BIG THANKS
+ 1
my question is...
what is "out" in
System. out.println();
+ 1
'out' is the class for the System OUTPUT. println() is a method of that class.
System.out is the namespace that contains println(), among other system output functions.
+ 1
You unknowingly did, which is why I only pointed it out. However, I am not mad at you and I understand how it happened, which is why I still posted the code examples for you and explained all of it. No worries! :)
Either way, you're welcome and I hope the information is useful toward your learning. Good luck with your studies! Take care bro.
+ 1
Thanks for your work..
I appropriate you.