在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中比较常用的打印输出方式,可以根据具体需求选择适合的方式进行打印输出。