Java output type question
Q. Java: Predict the output:
int x = 786;
cout << setfill(‘*’) << setw(6) << x;- Published on 29 Jun 15a. 786***
b. **786
c. ***786
d. ******
ANSWER: ***786
When set() manipulator is used, then output is right justified. So Out of 6 width, 3 are used by variable x and remaining 3 width (Spaces) are filled with char * due to setfill().