Reputation: 63
I'm knocking my head here using System.out.printf and I really don't understand something that seems that it should be much more simple.
public class main{
public static void main(String args[]){
double dog = 3.85;
double cat = 333.85;
System.out.printf("Hola:%7.1f\n",dog);
System.out.printf("Hola:%5.0f", cat);
}
}
I'm trying to understand what the significance is of the numbers after the percentage symbol. In short in the line:
System.out.print("Number: %x.y", someNumber);
what does the x tell me and what does the y tell me?
Upvotes: 0
Views: 112
Reputation: 38706
Upvotes: 1