954,136 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

C++ Vs Java

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++?

Firestone
Light Poster
37 posts since Nov 2006
Reputation Points: 10
Solved Threads: 0
 

>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
Bad Cop
Administrator
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
 

Ok. I know some C/C++ right now, and no Java.

Firestone
Light Poster
37 posts since Nov 2006
Reputation Points: 10
Solved Threads: 0
 

>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.

Narue
Bad Cop
Administrator
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
 

Ok, I'll work on mastering C for now, thanks.

Firestone
Light Poster
37 posts since Nov 2006
Reputation Points: 10
Solved Threads: 0
 

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++.

Killer_Typo
Master Poster
781 posts since Apr 2004
Reputation Points: 152
Solved Threads: 39
 

>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?

Narue
Bad Cop
Administrator
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
 

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.

TheGathering
Junior Poster
102 posts since Jul 2007
Reputation Points: 22
Solved Threads: 10
 
>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

Killer_Typo
Master Poster
781 posts since Apr 2004
Reputation Points: 152
Solved Threads: 39
 

The differences between java and c++

iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
 
>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?

quintoncoert
Posting Whiz in Training
266 posts since May 2007
Reputation Points: 160
Solved Threads: 3
 

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.:)

hinduengg
Junior Poster in Training
88 posts since Jun 2007
Reputation Points: 36
Solved Threads: 4
 
@ 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 themore powerful tool for many applications.

TheGathering
Junior Poster
102 posts since Jul 2007
Reputation Points: 22
Solved Threads: 10
 

@ 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?

quintoncoert
Posting Whiz in Training
266 posts since May 2007
Reputation Points: 160
Solved Threads: 3
 

>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
Bad Cop
Administrator
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
 
@ 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.

Bench
Posting Pro
577 posts since Feb 2006
Reputation Points: 307
Solved Threads: 63
 

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

AbyBaby
Newbie Poster
1 post since Jul 2007
Reputation Points: 10
Solved Threads: 0
 

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:

venomlash
Junior Poster
143 posts since Oct 2006
Reputation Points: 86
Solved Threads: 2
 
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.

jwenting
duckman
Team Colleague
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337
 
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++

Killer_Typo
Master Poster
781 posts since Apr 2004
Reputation Points: 152
Solved Threads: 39
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You