Java System.out.print and println

System.out.println example

println will append a new line after the string.

public class Main {
  public static void main(String[] args) {
    System.out.print("A" + "1");
    System.out.print("B");
    System.out.print("C");
  }
}
OpenJDK 64-Bit Server VM warning: Insufficient space for shared memory file:
   7883
Try using the -Djava.io.tmpdir= option to select an alternate temp location.

System.out.print example

print will not append a new line after the string.

public class Main2 {
  public static void main(String[] args) {
    System.out.println("A" + "1");
    System.out.println("B");
    System.out.println("C");
  }
}
OpenJDK 64-Bit Server VM warning: Insufficient space for shared memory file:
   7895
Try using the -Djava.io.tmpdir= option to select an alternate temp location.

Share this article: share on Google+ share on facebook share on linkedin tweet this submit to reddit

Comments

Click here to write/view comments