Diferença entre printf e format?

1 resposta Resolvido
javaformatprintf
D

Olá, existe alguma diferença entre usar o printf e o format?

Exemplo 01:

float nota = 5.3f
System.out.printf ("Sua nota: %.2f", nota)

Exemplo 02:

float nota = 5.3f
System.out.format ("Sua nota: %.2f", nota)

1 Resposta

L
Solucao aceita

Não existe diferença, segundo consta na documentação.

Printf
Format

A convenience method to write a formatted string to this output stream using the specified format string and arguments.
An invocation of this method of the form out.printf(format, args) behaves in exactly the same way as the invocation

out.format(format, args)
Criado 19 de abril de 2017
Ultima resposta 19 de abr. de 2017
Respostas 1
Participantes 2