Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
System.out.print(new DecimalFormat("00000").format(123));
p3n said:printf ? you mean system.out.println ?
This is pretty new, but see here for all of your printf needs. In particular, there is now a printf(String, ...) method in java.io.PrintWriter, which of course is what the ubiquitous System.out and System.err are.tim_m said:yeah, java sucks for not having a printf kind of thing
Also new, but there is definitely a varargs syntax now.tim_m said:not to mention for not allowing variable arguments, which could possibly allow printf
These have been intentionally omitted because they are so frequently abused. I'm not saying that's good or bad; that's just the reasoning behind it. Google will turn up plenty of persuasive writings on these topics. I myself do not miss either all that much, but I know plenty of people really hate that -- they don't feel Sun should restrict the programmers just because people misuse the features in other languages. Totally understandable.tim_m said:and also not having default arguments, and not having operator overloading
This is true but terribly misleading. The whole point behind the new autoboxing feature is to make that irrelevant. You just use Integer in your generic, and the primitive will be promoted or demoted as necessary. As an example, it's perfectly reasonable to make a new List<Integer> foo, add something via foo.add(3141), call functions like Collections.sort(foo), and so on. It's totally unnecessary to have primitive types be usable in generics.tim_m said:and its new generics which don't even allow primitive types
It sounds like you'd really appreciate a lot of the new features. Perhaps you could take this class as an opportunity to learn more about them. Though if your classes are anything like the ones I took, they won't care much about teaching you this kind of stuff.tim_m said:of course, i have to use it for my classes