Understanding Object-Oriented concept is a must (but that may be argued), whether it is with Java, C++ or other languages. In my days, knowing C++ was common, and Java came after. Nowadays, I'd say that you have to know Java, but that also may be argued. I went all the way until now without using .Net. But some people may have a different experience and spent years working without using Java. I think that Java is a good place to start with.
Although I have to say that in my opinion the plain unadorned "Which is better?" question is kind of tiresome. It would be nice to have just a little bit of direction about what "better" means to the original poster.
Otherwise I could reasonably answer that I've been programming for 40 years and I still don't know C++, and therefore knowing C++ isn't very useful.
Paul Clapham wrote:Otherwise I could reasonably answer that I've been programming for 40 years and I still don't know C++, and therefore knowing C++ isn't very useful.
That's what John was talking about :) I've used it a lot in my first years, and a couple of years after. But not as much as Java. I think it depends on where you work, what kind of work you do, and much more...
I agree that "which is better ?" is not appropriate, and that we need to know the intention of the poster.
What is your target field?
Embedded devices, gaming, web development, enterprise development, statistics, math, MSFT shop, mobile development, operating system programming ..?
The more context the better
As Christophe said- Understanding OOP principles is really useful. You could see that these days there are lot of languages coming up which run on the JVM- Groovy, Scala, JRuby, Clojure, Fantom and so on. All these are based on some programming paradigm like OOP, Functional Programming and so on. So its always better to understand why a particular paradigm is useful or what are its advantages. You could have a look at- Scala- which uses both Object oriented and functional programming concepts or you could have a look at JRuby. Considering the web applications frameworks- Groovy has Grails, Scala has Lift.
Its better to be aware of the Java syntax, OOP principles to start with.
The best is of course to master it all! That way you can get any programming job you want
Of course, "it all" is quite an extensive list. There are just so many around, even obscure ones like Brain**** (warning: the name is explicit!), LOLCODE, Whitespace and Malbolge*. And you can't forget the "old" languages like Cobol and Fortran, because even these are still in use.
In the end I think you should just focus on the one you like best first, then add another one after that. That's what I've done: started with Pascal / Delphi, added C++, added Java, added C, added Python, added PHP, added Visual Basic (because I had to). I've even glanced at Perl briefly but didn't feel like it at the time
What is important is to understand the concepts of programming: if statements, loops, object orientation, etc. If you understand those, another language is mostly just learning the syntax (how do I write a loop?) and libraries.
Hmm, when I learn a new programming language, it's usually to accomodate learning about another technology.
BASIC introduced me to programming, Pascal introduced me to data structures, functions and pointers. Java taught me a lot about object oriented programming, generics and threads. C and Assembly were useful when I got interested in operating systems, and now I'm starting to get into Scala, because I want to learn about functional programming.
C++ never appealed to me, mostly because I already used Java and C. I don't think there are many reasons to use C++ instead of Java, or the other way around. I'm sure that if I got into C++ before I got into Java, I now wouldn't be interested in learning Java.
Ah, the luxury of getting to choose what language you learn! Other than learning BASIC at school, I think pretty much every language I've learned is because I've had to use it at work (FORTRAN, VB, C++, Java, PHP, Perl, C, C# in that order being the main ones). I'm trying to promise myself that the next one will be my choice .
I'm myself a fan of Scala, it's a very interesting programming language that has object oriented and functional programming features.
Groovy is a dynamically typed programming language that looks a lot like Java; it's intended to be easy to learn for Java programmers.
Clojure is a funtional, Lisp-like programming language. It is not object oriented.
(J)Ruby and Jython / Python are dynamic programming languages that are not very hard to learn. For Ruby there's the popular Rails framework for web applications, which also works on JRuby.
For the past year, I've spent about half my time programming in C# (ofcourse on .NET, it doesn't run on the JVM). The language was easy to pick up; the hardest part was learning the standard library and the common idiom (the "normal" way of doing things in that language - the standard constructions that experienced C# programmers use and that are not documented anywhere explicitly).