Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Console IO

 
vivek dhiman
Ranch Hand
Posts: 153
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
Pie
Posts: 49776
69
  • 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: 153
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
Pie
Posts: 49776
69
  • 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