在Java中,打印輸出可以使用以下幾種方式:
System.out.println("Hello, World!");
System.out.print("Hello, ");
System.out.print("World!");
String name = "Alice";
int age = 25;
System.out.printf("My name is %s and I am %d years old.", name, age);
import java.util.logging.Logger;
Logger logger = Logger.getLogger("MyLogger");
logger.info("This is an info message.");
String name = "Bob";
int score = 85;
System.out.format("The student %s got a score of %d.", name, score);
這些是Java中比較常用的打印輸出方式,可以根據(jù)具體需求選擇適合的方式進(jìn)行打印輸出。