Java #40: How to create a New Line with printf

—————-Beginning of Program—————–
//Programmer: Akinwale Owi
//Company: Dagba Computers
//Program Purpose: Use printf to make a new line

package dagbacomputers;

/**
*
* @author Akin
*/

public class DagbaComputers {

/**
* @param args the command line arguments
*/
public static void main(String[] args)
{
//Normal printing with printf
System.out.printf(“The same”);
System.out.printf(” sentence. “);

//Break
System.out.println(“”);

//Creating the new line with “\n”
System.out.printf(“The same” + “\n”);
System.out.printf(“sentence. “);

}//end of main
}//End of DagbaComputers Class

————–End of Program——————–

——–Output——-

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

Up ↑

%d bloggers like this: