What I like to show you is:
|
But I cannot show you this fact by using
System.out.print( 12 );
|
because the print( ) function will first convert the number to an ASCII string (i.e.: "12") for your convenience
In fact, Java has provided many conversion methods within the print( ) methods (plural !!!) by using the overloading feature in the Java language.
|
This is the case with:
System.out.print( )
and
System.out.println( )
|
If you take a look at the documentation for the PrintStream Java class, you will see the overloaded methods print( ) and println( ):
void print(boolean b)
void print(char c)
void print(char[] s)
void print(double d)
void print(float f)
void print(int i)
void print(long l)
void print(object obj)
void print(String s)
|
The Java doc for PrintStream is here for easy access: click here
Therefore:
|
I can tell you that:
|
That's why we cannot use print( ) or println( ) to illustrate the need to convert to ASCII representation (because inside the need for conversion is taken care of by print( ) !!!.
If print( ) did the conversion (secretly) for us, there is no more need for us to do the conversion...)