I tried searching the forums for this, but couldn't find anything.

If I were to make a career out of computer programming, which would be better to learn, Java or C/C++?

>If I were to make a career out of computer programming,
>which would be better to learn, Java or C/C++?
If you don't know C, I wouldn't hire you. Period. If you don't know Java or C++, whether I would hire you or not depends on the job. However, I would recommend learning all three, starting with C, then moving to C++, and finally Java.

>I know some C/C++ right now, and no Java.
Let me clear this up for you right now. C/C++ is for experts only. C and C++ are two different languages and you would be wise to learn only one at a time. When people say C/C++, they mean some combination of C and C++ that can only be correctly written by someone proficient in both.

Comments
Well said.

java compilers and the java runtime environment are created using C++


learning both C and C++ is good but you may find yourself trying to unteach yourself things from C when you work in C++.

>learning both C and C++ is good but you may find yourself
>trying to unteach yourself things from C when you work in C++.
Yes, just like when you learn C++ and Java, C and C#, Java and Fortran, Perl and Python, LISP and Forth... Pick any combination of languages and your statement is absolutely true. So did you have a point or are you simply trying to propagate the usual C/C++ myths?

C++ and Java are fairly similar in terms of syntax and concepts. It takes a little time to get to used to the nuances of each, but learning one makes transition to the other vary easy.

I would strongly suggest you learn both. C++/Java are both very fast and powerful languages that will give you the flexibility to choose which language best suits your needs.

A C++ programmer once told me that C++ is where you learn to program, C is where you learn to shoot yourself in the foot. I don't agree with him, but C can be both a very powerful and dangerous tool in software development.

C is often used for hardware oriented software and as a metalanguage for hardware oriented languages. If you were truly going to make a career out of programming, C would most likely be the most applicable language you could learn and possibly the one that would guarantee you the most job security.

All that said, I would strongly suggest you learn all of the languages above well and not limit yourself to any one or two languages by also learning the .net and script oriented languages such as Perl and Python.

>learning both C and C++ is good but you may find yourself
>trying to unteach yourself things from C when you work in C++.
Yes, just like when you learn C++ and Java, C and C#, Java and Fortran, Perl and Python, LISP and Forth... Pick any combination of languages and your statement is absolutely true. So did you have a point or are you simply trying to propagate the usual C/C++ myths?

there are deffinate uses for both C and C++ but it is not necesarily true that one should learn C prior to C++ ;)

All that said, I would strongly suggest you learn all of the languages above well and not limit yourself to any one or two languages by also learning the .net

there have been numerous .NET jobs available lately. It seems as though businesses are picking up on the languages because of the little learning curve and they can have something visible (software wise) near immediate.

of course the tradeoff is the fact that somethings are best done through windows API not included in the .NET framework so one hase to call in the .DLL's through the use of the runtime.interopservices

>If I were to make a career out of computer programming,
>which would be better to learn, Java or C/C++?
If you don't know C, I wouldn't hire you. Period. If you don't know Java or C++, whether I would hire you or not depends on the job. However, I would recommend learning all three, starting with C, then moving to C++, and finally Java.

@ narue unless of course someone else knows exactly what she means.

Why? i know java and am learning c# and c++. but what is the point of C? what is so special about it that someone cant just learn c++ and use it for situations that also calls for C? are there really some programs that is best written in C? i have always been under the impression that games are the most difficult thing for a human to write as well as the most demanding thing for a computer to execute. so if games are written in C++ then what is the point of learning C?

You may opt for Java because its a new language that is yet to be developed instead of C or C++ . The latter have become full fledged,vast. There are thousands of sites which use java applets. Java is currently very popular , much more than the others.

For me Java was really easy to learn than C++. It had so nice sorting techniques , so lucid for anyone in my small view.:)

@ narue unless of course someone else knows exactly what she means.

Why? i know java and am learning c# and c++. but what is the point of C? what is so special about it that someone cant just learn c++ and use it for situations that also calls for C? are there really some programs that is best written in C? i have always been under the impression that games are the most difficult thing for a human to write as well as the most demanding thing for a computer to execute. so if games are written in C++ then what is the point of learning C?

As I posted earlier, C is used both as a metalanguage ( a language for creating other languages) and as a language for many hardware oriented software applications/drivers.

Learning C teaches responsibility in coding as it can be considerably more hazardous to your computer if you write shoddy code. While C++ may be safer and easier to use for application development, C is still the more powerful tool for many applications.

@ thegathering or narue or anyone else who knows.

i have gone on the internet and have seen that C is used primarily for system programing since it can access hardware addresses directly. i am a bit confused between what it can do and what c++ can do with memory addresses.

i know that a pointer in C++ can alter the value of a variable and how it does this. i assume that c also has that ability. but what i dont know is if C++ can directly access a memory location if that memory location is not assigned to a variable. i suppose that C can. in the light of that am i correct to assume that C can do things such as send a group of bites to lets say a printer port or a graphics card but that C++ cannot do that directly? (i.e. the only way c++ can do that is via a library written in C)

i originally thought that C was an outdated language and that C++ can do everything that it can do plus it can do object oriented as well. i just thought that learning C would be a waste of time since C++ includes C functionality as well. but that still does not explain why she would not hire someone who dont know C?

>there are deffinate uses for both C and C++ but it is
>not necesarily true that one should learn C prior to C++
Where did that come from? I wasn't talking about which one to learn first, I was talking about your magic comparison of two different languages that somehow makes sense to you but not in reality. Of course you would have to be careful not to mix in C styles when working with C++, just as you would have to be careful not to mix C styles when working with Java. That's what I was talking about.

>what is so special about it that someone cant just learn
>c++ and use it for situations that also calls for C?
C is available on more platforms than C++, so if you work on one of them you have no choice. There's more C code than C++ code out there, and you can expect to be asked to work with some of it. C is considered the base language that every programmer should know. C++, Java, C#, Perl, and the majority of the mainstream languages are based off of C. If you know C, you have insight into why those languages are the way they are. And most importantly, programming culture has grown to expect you to recognize and read C to some extent. It's much like the pseudo code used in technical papers. You're simply expected to know it, and if you don't, you're only hurting yourself.

>am i correct to assume that C can do things such as send a group of
>bites to lets say a printer port or a graphics card but that C++ cannot
>do that directly?
No, C++ can work at the same low level as C.

>i originally thought that C was an outdated language
Just because it's old doesn't mean it's outdated.

>and that C++ can do everything that it can do plus it can do object oriented as well
Keep in mind that object oriented programming doesn't have to be supported directly by language features. Most of the guidelines in OOP can be followed in C with minimal effort. The rest can be simulated.

>i just thought that learning C would be a waste of
>time since C++ includes C functionality as well.
Learning a new language is never a waste of time.

>but that still does not explain why she would not hire someone who dont know C?
That's simple. If someone doesn't know C, that's a good indication that he lacks the experience, drive, and foresight that I look for in exceptional programmers. If someone doesn't know C, the only way he can claim to have worked low level enough to do the jobs I hire for is to know assembly. If he knows assembly but not C, that's a huge red flag because it suggests he's either quite the beginner, or he's too dogmatic about assembly to be of any real use as a professional developer.

@ narue unless of course someone else knows exactly what she means.

I expect the reason is that C is still the most widely used general purpose programming language. It doesn't really matter what features are available in C++/Java/etc when an existing system is written in C - many jobs will likely involve maintaining or updating legacy code rather than starting out entirely from scratch - something which you can't do unless you're familiar with the language its written in.

I blv Java and C++ both have a place of their own and it is better to learn both.

Probably coding in Java for application programming is better in the long run. This is specially true because of the fact that Java is converging in terms of performance with C++ with every successive release. Besides you escape from memory leaks and crashes caused by faulty C++ code.

In product development many a times you will find that part of the code is in C++ while part of it is in Java. So if you want to be at the core of things you need to know both.

For me, it is like, I need to know C++ because I need to know the product by knowing legacy code. I need to know Java because I love coding in Java.

AbyBaby

Try C# sometime. I hear it's halfway between JAVA and C++, so that might be useful. Personally, I'd say C++ is easier to work with; strings are mutable, you just have to type cout instead of System.out.print, and many other little things that make coding easier. Of course, I know very little about coding, so hey...:icon_mrgreen:

java compilers and the java runtime environment are created using C++

Possibly, but not necessarilly.
You can just as well write a JVM in say Fortran or Assembly.
Or create one in hardware.
Anyway, the language a compiler or operating system is written in is no indication that you should know that language first before you can master the language that compiler compiles.

learning both C and C++ is good but you may find yourself trying to unteach yourself things from C when you work in C++.

And the reverse is equally true (though enforced by the compiler).
If you're good enough you recognise the different paradigms and don't mix them without very good cause.

Possibly, but not necessarilly.
You can just as well write a JVM in say Fortran or Assembly.
Or create one in hardware.
Anyway, the language a compiler or operating system is written in is no indication that you should know that language first before you can master the language that compiler compiles.

I am pretty sure they are. If you go to java's website and grab the SDK's and tool kits they all come packed as C++

I am pretty sure they are. If you go to java's website and grab the SDK's and tool kits they all come packed as C++

That's only for people who choose to use those tools. For example, a platform where there's no C++ compiler available, the JVM would most likely be written in another language.

and just because in practice most are, that doesn't mean that they have to be (which was the assertion).

I tried searching the forums for this, but couldn't find anything.

If I were to make a career out of computer programming, which would be better to learn, Java or C/C++?

I believe what you should start on first is the foundations of programming, perhaps start out with Turbo Pascal 7 and learn how variables, arrays, pointers, linked lists, sorting algorithms work etc... TP7 is an out dated language, yes, but can teach you alot and help you build confidence is coding, some schools / universities are still teaching Pascal.

to really answer your question, out of C / C++ / Java I would actually start with JAVA, the reason being Java has alot of tools available to you which will make your life alot less hassle when working on applications or even games (yes, Java is good for games too). Like anything new your find it difficult to begin with, but persevere and your soon find that you can create applications.

Once you learn Java a new world will be open to you, applications, games(JOGL, LWJGL) and even mobile development using J2ME :)

although I would suggest you learn C++ at some point, you will have so much more fun learning Java as your find you can develop solutions quicker than in C or C++.

best of all, according to recent statistics(http://www.tiobe.com/index.htm?tiobe_index), Java is the most popular language at the moment, now, that's either a good thing or bad thing when looking for a job, but there are always Java positions available for a nice sum of money.

I would have suggested learning Visual Basic .NET first as it's pretty easy to get started, but in the VB 5/6 days I used to write database applications, but for some reason it always seemed as though I was getting nowhere with VB, even though I knew ALOT about the language, it never 'fulfilled' me - if you know what I mean LOL.

Comments
while i dont personally agree with starting with Turbo Pascal 7 i do agree with your logic behind learning the basics and how things work!

Right now it is also pretty worthwhile to learn C#

languages i would recommend (through countless hours of interviews and job searches) are C, C++, C#, and Possibly ASP.NET (if you are interested in web based applications).

I have found that there are a supprisingly large number of people looking for these qualifications (well not so supprisngly for C / C++ :) )

For a career? – It depends on what you want to do; if you want to write video games – start learning c++, if you want to write enterprise software - java or .net, there’s plenty of specialized languages and scripts out there for specific applications too – for example; Verilog, Actionscript, PHP, calc, etc. It’s more about the supported underlying library then the language itself – if you’re an employer, you don’t want to pay someone a month to do something in C++, when half of it’s already done in the .net or java ee framework and it could be done in a week. Even if the C++ version could theoretically perform better – the additional hardware to make up for it is going to cost less then the programmer, -that programmer is going to have to do better then all the people working on that underlying framework.

The nice thing about .Net and MSCPP is that they have a well-documented and organized platform library. Java would be nice if Sun actually helped organize and certify the stuff that’s scattered all over the net. As for GCC, Dev-C++ has a really nice manager for libraries and dependencies, it will also import VCPP projects. Perl’s CPAN is also nice.

I believe what you should start on first is the foundations of programming, perhaps start out with Turbo Pascal 7 and learn how variables, arrays, pointers, linked lists, sorting algorithms work etc... TP7 is an out dated language, yes, but can teach you alot and help you build confidence is coding, some schools / universities are still teaching Pascal.

You most likely believe this because thats the way you learned, and thats fine. Although, teaching has evolved, and with good reason.

The idea of an introductory programming course was once, as you describe, to start out with the low level 'fundamentals' .. although, these kinds of courses have been shown for many years to be intensely frustrating for a complete novice who's never had any experience with anything other than office applications. Herein lies the problem that programming has a terrible reputation as a result, of being impossibly hard, and only for "elitist hackers" or "complete geeks". (And the net result is that people are put off programming entirely, because they convince themselves that they can't do it)

So, using languages such as python or java to teach basic programming, this reputation is slowly diminishing, since learners find themselves in more comfortable environments where they can learn all the same concepts and thought processes about programming (loops, arrays, structures, etc) without needing to worry about all the nasty 'gotcha's' (yet!). as a result, far more people feel confident that they can understand programming, than before.

The one downside is that some people convince themselves that they're experts just because they know a few lines of java. But in the long run, anyone who's serious after learning a "comfortable" language will most likely dive into low-level languages afterwards, so the net result is the same, but without the frustration.

With that aside, anyone who's looking to learn any specific language (Whether its C/C++/Java/etc), should concentrate solely on that language, and not fall into the trap of picking another one as a launching-pad

yeah, I see your point Bench, but I suggested Pascal because of the simplistic syntax and it will allow people to start coding straight away, allowing the learner to get to grips with a few basics before going on to OOP.

it's not impossible for a complete beginner to go to Java first and I absolutely recommend it - which is why I stated Java would be a good language to start with.

I should have been more specific about what i stated, if a learner starts with pascal it's not necessary to spend years on it, perhaps a couple of months to help them get a feel for a programming language and so they don't feel so 'overwhelmed' at first, also don't forget society has changed, we are in a results society whereby individuals want things done 'NOW' not yesterday.

I would rather start with:

uses crt;

var
num1 : integer;
num2 : integer;
sum : integer;

begin
sum := num1+num2;
writeln('Total = ', sum);
end.

than:

public class sum
{
int num1;
int num2;
int total;

public static void main(String[] args)
{
total=num1+num2;
System.out.println("Total = "+total);
}
}

This article has been dead for over six months. Start a new discussion instead.