Learning C for its own sake is great (I like C myself
), but I wouldn't recommend learning C for the sake of learning Java. I started out with C and I had a hard time migrating to Java because the programming styles are very different.
For example, in C you pass a pointer or a local copy of a data structure to a function that manipulates your data structure -- in Java you have a construct called a
class which is like a data structure, except it has its own functions (called
methods) that exist in the same scope as your data structure. There is no need to pass an instance of your class inside your class's method -- it already aceesible by default through a special pointer called
this. More significantly, in Java (but not in C) there is this concept of an
object which you must be totally familiar with, as the entire programming style of Java revolves around the object model.
Ok, C++ has a steeper learning curve, but if you really have plenty of time in your hands, why not? C++ and Java have more similarities than differences, but you have to supply a bit of self-discipline to write object oriented programs in C++ (the Java compiler is much less forgiving). Plus you get to appreciate each language more.
Oh, and there's no need to learn C first before learning C++
. Even Stroustrup said as much.
-anthony