This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: OR import java.util.*; //to import all classes in this package System.out System.out is a destination (object) to which we can send output. Commonly used methods are "print" and "println". In order to print out "Hello World" in a console, we can use a code: System.out.print("Hello World"); You can print out a primitive data type using "print" method as well as strings. To concatenate a string with a string, or a primitive data, you can use "+". For instance, int number = 10; System.out.print("The number is " + number); "println" method adds a carriage return at the end. Thus System.out.print("Hello World\n"); and System.out.println("Hello World"); will give the same result....
View Full Document
- Spring '10
- Object-Oriented Programming, Subroutine, Java identifiers, Java API Specification, pre-defined Java classes