Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Console IO  RSS feed

 
vivek dhiman
Ranch Hand
Posts: 155
Netbeans IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi..

Please tell me what is the difference between printf() and print() function. Which one is better to use any why?

Thanks.
 
Campbell Ritchie
Marshal
Posts: 55722
163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Neither is a function. You can find out about printf here, about print() here and about what you thought you were asking about here.
 
vivek dhiman
Ranch Hand
Posts: 155
Netbeans IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its helpful. Thanks a Lot.

But still confused about format() and printf() function. If possible give some short example.

 
Campbell Ritchie
Marshal
Posts: 55722
163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What format and printf function? They are neither of them functions.

Actually, if you are thinking of the same format and printf methods I am thinking of, says what the difference is in the documentation.
 
Rahul mir
Ranch Hand
Posts: 38
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
printf is generally used for formatted output

printf("format string", argument(s));

print is use for simply displaying output.



 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!