Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Console IO

 
vivek dhiman
Ranch Hand
Posts: 152
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
Sheriff
Posts: 48404
56
  • 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: 152
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
Sheriff
Posts: 48404
56
  • 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