answersLogoWhite

0


Best Answer

The println method outputs a newline character after the arguments you pass to it. The code for println basically looks like:

public void println(String x) {

print(x);

newLine();

}

User Avatar

Wiki User

15y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

11y ago

The notable difference is that printf gives the option to display formatted output rather than simple, defaulted text. println just prints the text as plain output and begins a new line.

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

They are both output streams provided by Java. The difference is that println always prints the contents in a new line whereas print does not.

ex:

System.out.print("Hi ");

System.out.print("There");

Produces an output

Hi There

whereas

System.out.println("Hi ");

System.out.println("There");

Produces an output

Hi

There

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the difference between the printf and the println statement in java?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Difference between printf and fprintf?

printf (*) is equal to fprintf (stdout, *)


What is the difference between the printf and scanf statements in C?

well major difference between scanf and printf is that scanf is an input statment and printf is an output stament scanf is used to take data in from the user and printf is used to display the result on the screen Regards


The Java method printf is based on the?

Java doesn't have a printf method. To provide the implementation of printf method of C in java, the java has two print methods. They are1. print()2. println()The first method prints the text in braces on the same line, while the second is used to print on the next line. In fact, ln in println() stands for next line. We need not use /n while working in java.Actually, the System.out.format() function is practically identical to printf in C. When translating code from C to Java, you can generally replace all calls to printf(args...) with calls to System.out.format(args...)....and to answer the original question, Java's System.out.format() method is based off of C's printf() function.


Without printf statement semicolon print the statement?

int main (void) { if(printf("Print whatever you want")) { } }


What is the function and syntax of printf statement?

it's not a statement, it's a function: len= printf (format, ...more-parameters...);


Calculate length of string using printf statement only?

printf does return the length: size_t len = printf ("%s", str);


What is the type of printf statement in C?

It is a function.


Can anyone give a logic in c plus plus to print something on screen using printf statement but without semicolon used after printf statement?

try to usecondition ? value if true : value if falseor: if (printf ("Hello")) {}


What is the difference between echo and print and printf in PHP?

The print function is slightly more dynamic than the echo function by returning a value, and the echo function is slightly (very slightly) faster. The printf function inserts dynamic variables/whatever into wherever you want with special delimiters, such as %s, or %d. For example, printf('There is a difference between %s and %s', 'good', 'evil') would return 'There is a difference between good and evil'.


In which direction does the printf statement works?

from main-memory to standard output.


What is the difference between cprintf and printf?

The printf function calls on fprintf to write the result of sprintf to standard output. That is:printf("%i\n", 42);is exactly equivalent to:fprintf(stdout, "%i\n", 42);


What is the difference between echo and printf command of UNIX?

Echo merely repeats its command line arguments as stated. The 'printf' command allows for formatted print and a more exacting method of printing out information. Printf requires you to specify the format of what you want to print; echo does not have this ability.