Most any current distribution is suitable for learning how to program in Java and/or C/C++. My personal preference (personal, and preference) is to use Red Hat Enterprise Linux, or clones thereof (CentOS or Scientific Linux). In fact, I use all three, and I have used Ubuntu extensively in the past. Unfortunately, my opinion is that Ubuntu started regressing after 9.04, so I don't use it any longer. RHEL 6.1, or a clone thereof, is my preferred system these days, and I do a LOT of serious software engineering. My current position/title is Senior Systems Engineer at Nokia Mobile Phones. I do Java and C++ software engineering for a living.
FWIW, in my organization we use Java and C++ extensively, and our server software all runs on Red Hat Enterprise Linux. Our newest stuff runs on 6.1. Older stuff on 5.x. In my opinion, 6.1 has been a major improvement in hardware support, especially WiFi on laptops.