println("test")相当于print("test\n")就是一般的输出字符串 

double temp = 21.63;
            
System.out.println("Hello World");
System.out.println("temp == " + temp);
System.out.printf("1111 temp == %.1f" , temp);
System.out.print("22222 ==== " + temp);
//System.out.print("====>>>\n");

Android studio中关于printf和print和println的区别-LMLPHP 

double temp = 21.63;

System.out.println("Hello World");
System.out.println("temp == " + temp);
System.out.printf("1111 temp == %.1f\n" , temp);
System.out.print("22222 ==== " + temp);
System.out.print("====>>>\n");
Log.d("111111","22222");

Android studio中关于printf和print和println的区别-LMLPHP 

提示一下:我这边用的新版Android studio(2024.1.2)编译实现的 

 

 

11-11 02:57