简体   繁体   English

NSLog是否与Java中的System.out.print相同?

[英]does NSLog work the same as System.out.print in Java?

I am migrating from Java to Objective-C, so having a bit easy but meaningful question, 我正在从Java迁移到Objective-C,因此有一个简单但有意义的问题,

can I do 我可不可以做

NSLog(@"\n"); // instead of 
System.out.println();

and

NSLog (@"%i",a); //instead of 
System.out.print(a);

Yes. 是。 NSLog prints the message to stderr. NSLog将消息打印到stderr。 The only difference from printf is that it adds some extra info (like time and build name). 与printf的唯一区别是它添加了一些额外的信息(例如时间和内部名称)。 printf prints to stdout. printf打印到标准输出。

Sort of, but not quite. 有点,但不完全是。 NSLog prints to stderr, and to the system log. NSLog将打印到stderr 系统日志。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM