Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What is the output of printf?

 
Henry Zhi Lin
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is from exam lab,



what is the output of this, and could you explain it?
 
Henry Wong
author
Marshal
Pie
Posts: 21211
81
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is from exam lab,



BTW, what is "exam lab"? Please provide more detail on this source.

Henry
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15369
40
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you try compiling and running it in a small test program? What is the output? Can you explain it yourself? Have a look at the API documentation for the printf() method in java.io.PrintStream for information on how printf() works.
 
Henry Zhi Lin
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Henry Wong:



BTW, what is "exam lab"? Please provide more detail on this source.

Henry


This is from the new SCJP simulator which I download from www.examlab.tk
 
Henry Zhi Lin
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jesper Young:
Did you try compiling and running it in a small test program? What is the output? Can you explain it yourself? Have a look at the API documentation for the printf() method in java.io.PrintStream for information on how printf() works.


Sorry, I may just want a quick answer from someone, in fact whenI looked the http://java.sun.com/j2se/1.5.0/docs/api/java/util/Formatter.html page, I do understand why and how to get the output.

Thanks for your not so easy answer!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic