What is the difference between these two?
System.out.println outputs a newline character afterwards:
UNIX > cat prog28.java
public class prog28
{
public static void main (String args[])
{
System.out.println("International DBA");
}
}
UNIX > javac prog28.java
UNIX > java prog28
International DBA
UNIX >
… but System.out.print doesn’t:
UNIX > cat prog29.java
public class prog29
{
public static void main (String args[])
{
System.out.print("International DBA");
}
}
UNIX > javac prog29.java
UNIX > java prog29
International DBAUNIX >
… although you can add one yourself if you wish:
UNIX > cat prog30.java
public class prog30
{
public static void main (String args[])
{
System.out.print("International DBA\n");
}
}
UNIX > javac prog30.java
UNIX > java prog30
International DBA
UNIX >
If you have a Java book on Amazon, which you would like to advertise here for free, please write to me at international_dba@yahoo.co.uk.
If you have a Java book on Amazon, which you would like to advertise here for free, please write to me at international_dba@yahoo.co.uk.