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

1.4k Views Asked by At

I am migrating from Java to Objective-C, so having a bit easy but meaningful question,

can I do

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

and

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

There are 2 best solutions below

1
Max On BEST ANSWER

Yes. NSLog prints the message to stderr. The only difference from printf is that it adds some extra info (like time and build name). printf prints to stdout.

0
Mike Baranczak On

Sort of, but not quite. NSLog prints to stderr, and to the system log.