System.out.println() in Java

Google Advertisements

Prev Tutorial Next Tutorial

System.out.println() in Java

In java language print() and println() are the predefined non-static method of printStream class used to display value or message either in the same line or line by line respectively. PrintStream class is having fixed object reference in the System class (existing as a static properties) so that either print() or println() method can be called with following syntax..

system.out.println

Syntax

	System.out.print("--------------");
	System.out.println("------------");

/* "out" is Object reference of printStream class
 existing in system class as a static property. */

Example

class  PrintStream
{
println()	//-----------> non-static
{
........
}
print()	 //-----------> non-static
{
........
........
}
}

class  System
{
Static  PrintStream  out;
Static  PrintStream  err;
}

Examples of SOP Statements

Example

System.out.println("Hello");    // ---------> Hello
int  x=10, y=20;
System.out.println("x");	  // ---------> x
System.out.println(x);	// ---------> 10
System.out.println("Hello"+x);	// --------->  Hello10
System.out.println(x+y);		// --------->  30
System.out.println(x+y+"Hello");	// ---------> 1020Hello

Example

class Hello
{
public static void main(String arg[])
{
System.out.println("Hello word");
}
}

Output

Hello Word

Prev Tutorial Next Tutorial

Google Advertisements

Buy This Ad Space @$50 per Month, Ad Size 600X200 Contact on: hitesh.xc@gmail.com or 8076671483

Pure VPN Privide Lowest Price VPN Just @ $1.65. Per Month with Non Detected IP Lowest Price Non Detected IP VPN

Magenet is best Adsense Alternative here we earn $2 for single link, Here we get links ads. Magenet

Cloud computing is the on demand availability of computer system resources, especially data storage and computing power, without direct active management by the user. Cloud Computing Tutorial

College Projects Related to Java, AWT, C Projects for College, C++ Projects for College, Android Projects. Download Java C C++ Projects

Download Projects

Adsense Advertisements


Buy This ads Space 8076671483

Buy This Ad Space @$120 per Month, Ad Size 300X600 Contact on: hitesh.xc@gmail.com or 8076671483 Try this Keyword C++ Programs