Notas
intermediate java
Conteúdo das notas (1)
Página 1
System.out.printf() allows us to output strings that are formatted in the code using format specifiers. Format specifiers begin with the ‘%’ sign, followed by the type of variable we want to print. Some examples include %s for a string, %c for a character, and %d for an integer.
Let’s look at a modified version of the Java program that uses System.out.printf(). Notice that variables in our print statement are stated in the order that the format specifiers appear.
String world = "World";
int day = 1;
System.out.printf("Hello %s! Today is Day: %d of your Intermediate Java course!", world, day);
This code would show the following output in your program:
Hello World! Today is Day: 1 of your Intermediate Java course!
Informações
- Descrição
- Computer Science Notas sobre intermediate java, criado por The RandomMan em 28-11-2024.
- Criado por
- The RandomMan
- Visualizações
- 0
- Avaliação