Your counting
the ending brackets as lines?! What a crock!
Aereshaa said:
Java is not the best language for teaching programming.
I don't think anyone was saying that, Aereshaa. By far the best language to teach people programming in is Python (or an equivalent scripting language, don't hit me!). Done and done, and I don't think there's any argument you're going to get from people on that point. However, I think what you're trying to demonstrate is it's easier to teach someone C++ than it is Java, and I wholeheartedly disagree.
Certainly the "Hello World!" Java program introduces OOP, but that's because Java is almost strictly an OOP language. Telling someone "This class thing on the top, just remember that the name after 'class' and the name of the file have to be the same" isn't that hard, and most newbies will be able to grasp that basic fact rather quickly. Then "public static void main", sure, that on the surface may sound complex (and in fact you have no idea what it means, which I'd be glad to explain), but it's also very easy to summarily say "This is how you always start the main function" and get around to explaining every detail of what that says later. Unlike in C++, where you have to "unteach" people void main, this method in Java is always right. Finally, "System.out.println()" has nothing to do with packages. System is an object that represents the computer itself, out is a PrintStream object System has, and println is a function. If you had known anything about Java (something you should probably do before criticizing it), then you'd know that. There, was that really that hard to understand?
Whereas let's look at the C++ example, and apply your logic. Surely there are fewer words, but in these fewer words there are greater explanations. What the devil is that "std::" thing, anyway? Oh, you're going to introduce
namespaces to a new programmer who hasn't even learned about classes?! What
is cout, anyway? Why do you need to "#include <iostream>", and what does that mean? Do you also want to give the student a crash course in operator overloading ("<<")? And what's that "\n" thing? Do you want to have to explain all of this to someone who's
never programmed before?
I didn't think so.
Instead, you just say "this is how it works, you'll understand why after you've understood more basic stuff", and it's really that simple. Both of these languages expose quite a bit of complexity for even the most basic of programs. That's not a bad thing, it's simply how a programming language in most cases works. I also know that JCoder has shown an image of a crazy C++ hater, but to say that his antics are representative of
all Java programmers is preposterous. If you've got a problem with Java programmers, then you've got a problem with
me.
Now, the easiest thing, in my opinion, to explain is this:
[highlight=Python]print("Hello World!")[/highlight]
So, I agree with your statement that Java isn't the easiest language to teach, but it is most definitely easier than C++, because teaching someone how to program
is not teaching them Hello World. Not by a long shot.