hello there to everybody ! ...
i am giving the exam on Saturday but i still have some problems understanding easy stuff !
whatever i have read in Books the resources they offer are not enough and i can't understand what the @D#@D#@ it does
System.out.printf("%f is the best value %b",Math.PI,Math.E);
what is %d ? and what is %f ?
what do i accomplish by using printf ? please someone help me on this ! it might look simple but this thing is bugging me off all the time and i am
missing questions when i try the devaka and whizlabs Exams
Time is relative so there is no way i can be late.
The printf function is as old as dirt (or C.) Basically, it uses a string format (which is a string which may contain both literal characters and format specifications, like %f and %b) along with additional arguments. The idea is that each argument after the format string is matched to a format specification, and converted to a string according to the format specification. For example, %f will convert the corresponding argument to a floating point string representation, and %b will convert the argunent to either "true" or "false" depending on some conditions. There are a lot of rules (you need to look at the java.util.Formatter Sun API docs, where all of this is specified.) But since you are taking the exam this Saturday, you probably don't have time to that. I recommend in that case that you review what you read in your books and ask if you have any questions. I think K&B covers this sufficiently well for the exam (but not exhaustively.) For exhaustive coverage, refer to the java.util.Formatter documentation. But I don't recommend it with your exam being so close.
All code in my posts, unless a source is explicitly mentioned, is my own.
Joined: Aug 26, 2008
Do you know what %b this stands for ?
it always prints true ?