println than printf , when i asked him why?
He replied " Cus printf has some issues with java, so he recommends using print or println than printf?
Do you think there is any issue?
also, Can you tell me which is most important situation when we use printf?
example of teacher:
System.out.printf (" The principal is %d \n number of years: %d, \nrate is: %f \n The calculated simple interest is:%f\n ", principal,noy,rate,si);
where principal, noy is int and rate and si is double.
System.out.println (" The principal is"+principal+ "\n number of years:" +noy+ "\nrate is:"+rate+"\n The calculated simple interest is:"+si);
Both works, but which is better to use in real life programming??
It shouldn't piss him off if you merely said something like, "I'm curious, what are the issues with printf, so I can avoid problems in my future programs?" (Unless he really doesn't know and is just blowing smoke - then he might be pissed off)
Fixing incorrect format strings is definitely more trouble than using println with concatenation, so maybe he just wants to avoid a lot of the hassle with it.
"Issues" is a rather broadly generic word, so he could be referring to any number of things. I'm curious what they might be.
Edit: I do agree though that you should just do it the way the prof wants it done. He's the gatekeeper you have to pass for that 'A'.
Yes, please do ask him about this, and let us know what he says.
I don't think it's likely that you can annoy a teacher by showing an interest and trying to learn more. It might be best to pursue it during office hours or after class, because he's probably got plenty of material to go over in his lectures, but do follow up on it.