1 Whats the coding difference between Systemoutprint and Sys
1. What\'s the coding difference between System.out.print and System.out.println ?
2. What wrong with this code?
/* Sample Coding
Computer Programming I
PRG420
DATE: 11/30/2016
Instructor: Vince Anderson
UOP Online
// Sample code to display Hello World
public class Hello
{
public static void main (String[] args)
{
System.out.print(\"Hello World\");
}
The errors are:
Hello.java:1: error: unclosed comment
/*
^
Hello.java:18: error: reached end of file while parsing
2 errors
Solution
System. out.print(\"Hello World\")
prints the data in same line if it is in loop
Ex:Hello World Hello World Hello World
System. out.println(\"Hello World\")
Prints the next data in new line
Ex:Hello World
Hello World
Hello World
Correct code
public class Hello
{
public static void main (String []args)
{
System. out.print (\"Hello World\");
}
}
