how system.out.println() works?
Answers were Sorted based on User's Feedback
Answer / subbu
//the System class belongs to java.lang package
class System {
public static final PrintStream out;
//...
}
//the Prinstream class belongs to java.io package
class PrintStream{
public void println();
//...
}
java.lang package is default package hence no need to import
additionaly to use System class
System is having static reference of PrintStream class whihc
has println() method.
So we can directly acces the println() using out referece.
System.out.println();
| Is This Answer Correct ? | 16 Yes | 0 No |
Answer / manish
In system.out.println()
'System' is a class which is having reference variable 'out' of type printStream class, and PrintStream class having overlaodded methed 'println()' for different purposes..
| Is This Answer Correct ? | 7 Yes | 0 No |
What do you mean by global variable?
How do I write a self declaration?
what are the uses of Class class and what it returns? explain it with the example code.
What do you mean by byte code?
I declared main() method as private. But it still running and displaying the output. Please Answer it . Code Snippet as Below: import java.io.*; class over { private static void main(String[] args) { int high = Integer.MAX_VALUE; int overflow = high + 1; int low = Integer.MIN_VALUE; int underflow = low - 1; System.out.println(high + "\n" +overflow +"\n"+ low +"\n"+underflow); //System.out.println(overflow); //System.out.println(low); //System.out.println(underflow); } }
I want to print “hello” even before main is executed. How will you acheive that?
What is the main difference between java platform and other platforms?
Why webdriver is an interface?
What are different type of exceptions in java?
How do you sort in java?
how are methods defined?
Can we have try block without catch block?