Sign in to follow this  

C++ vs. Java?

This topic is 4421 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

What's the differences between C++ and Java? What is mostly used today? What's fastest? When was Java created? Which language is most functional? What do I learn most from? What language are used for console games? other things..?

Share this post


Link to post
Share on other sites
Quote:
Original post by Cinder
What's the differences between C++ and Java?

What is mostly used today?
What's fastest?
When was Java created?
Which language is most functional?
What do I learn most from?
What language are used for console games?

other things..?


1) c++

2) c++

3) recently compared to c++

4) both can do what you need. java can be extended with native modules if required

5) both

6) AFAIK there is no way to run java on consoles.

learn whatever langauges based on research of what your program will need, and use the language that best suites both the project, your style and personal preference

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Unless you happen to have an operting system on your console like I do :D I agree with everything said above, and if you need some advice, start with C++ ;)

Share this post


Link to post
Share on other sites
Quote:
Original post by Cinder
What's the differences between C++ and Java?

What is mostly used today?
What's fastest?
When was Java created?
Which language is most functional?
What do I learn most from?
What language are used for console games?

other things..?


Most important question: What impact does/will this have on your programming projects?

Now to answer your questions:
Google says: Java, as of August 2004
Depends on application and if JIT is used, but from common knowledge C++.
Please Google for this information.
Functional in what way?
You learn much from each. C++ and Java were made to focus on different needs.
C++ is used for console games. Java is used (as well as Flash) for web games.


Share this post


Link to post
Share on other sites
Quote:

What's the differences between C++ and Java?

C++ compiles to machine-code, Java complies to a machine-independent code called Java bytecode, which can be executed on a Java virtual machine or translated to machine-code through JIT.

Quote:
Original post by Cinder
What is mostly used today?

Depends in what area you're talking about, I think Java is the winner in server-based stuff and c++ is most popular in end-user apps.

Quote:

What's fastest?

Be more specific, this question is too general to answer.

Quote:

Which language is most functional?

What does that mean?

Quote:

What do I learn most from?

I would say Java, since the language is more restrictive about certain things (for example, much less implicit casting, forcing you to keep public classes in seperate files, etc..), it generally forces you into good programming habits and good organization.
Quote:

What language are used for console games?

C++

Share this post


Link to post
Share on other sites
Quote:
Original post by Cinder
What's the differences between C++ and Java?

What is mostly used today?

Both are widely used. Sourceforge reports 16577 projects for C++, 16516 projects for Java - less than a 1% difference. The numbers for a given type of project will differ more widely.

Quote:
What's fastest?

Java at UI development time.
C++ at raw poetential power per clock cycle.
It really depends on what you mean by fastest.

Quote:
When was Java created?

More recently than C++.

Quote:
Which language is most functional?

They're both better at different things. Without defining "functional" more specifically, this is unanswerable.

Quote:
What do I learn most from?

Learning both, and other languages as well, so you can use the right tool for the right job.

Quote:
What language are used for console games?

C/C++.

Quote:
other things..?

Well, other things have been programmed in just about every programming language known to man. Even brainfuck has a hello world program out there I believe. Python, Lisp, Perl, PHP, ASP, Bash script, D, Ruby, Smalltalk, Visual Basic... the list goes on and on.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Java's related to the link posted http://www.developer.com/lang/article.php/3390001
Is most likely listed on the top for one very specific reason, its used in colleges/universities because unlike other languages its cross platform which allows the students to create there projects at home regardless of the operating system.

Share this post


Link to post
Share on other sites
Quote:

other things..?

Yeah, your question won't tell you anything useful.
What you will learn most from is to learn programming. Whether you use Java, C++, Whitespace or Prolog doesn't really matter. (What do you learn the most from? English or French? And which is fastest? Or most functional?)
Oh, and one thing you probably should know is that language VS. threads aren't allowed on the forum (At least, I think so. Haven't checked, but in either case, they're useless, even for the original poster, they incite flame wars, and generally frowned upon [wink])

Share this post


Link to post
Share on other sites
I use C++ and Java.

It's definitely easier to hack something quickly together using Java, but I think C++ streaks ahead.

C++ code compiles and runs faster without the added bloat of the Java JIT system.

I'd say Java, however, is the easier language, but it forces you to put everything inside a class, which I don't particularly like. I think C++ gives me more freedom if I want to write a more procedural program using global variables etc.

But I'm sticking with Java for now and learning C++ in my own time, simply because Java is being taught formally as part of my CS degree.

Summary:

C++ offers higher and faster performance, but is a more complicated and difficult language to use.

Java is easier to use, but is bloated and slow. I also don't see how EXE's are compiled using Java either.

Share this post


Link to post
Share on other sites
Quote:
Original post by pinacolada
Quote:

What's the differences between C++ and Java?

C++ compiles to machine-code, Java complies to a machine-independent code called Java bytecode, which can be executed on a Java virtual machine or translated to machine-code through JIT.


How a language is compiled is not exactly a great indicator of difference since Java can be compiled to native and C++ can be compiled to bytecode for a VM and it's already been done.

Share this post


Link to post
Share on other sites

1) TIOBE Programming Community Index for August 2004

Java is the most used, followed by C, followed by C plus plus.

2) C plus plus has the most potential for being faster.

3) 1991

4) Depends on what you want to do.

5) C plus plus, because you can learn 4 languages at once with it! C, C plus plus, Macro pre-processor, and assembly. :-P

6) I'm not aware of any Java based console games, though it seems they are used on cellphones.

Share this post


Link to post
Share on other sites
Quote:
Original post by snk_kid

How a language is compiled is not exactly a great indicator of difference since Java can be compiled to native and C++ can be compiled to bytecode for a VM and it's already been done.


And the same goes for the "speed" of a language. C++ code can be compiled to be just as bloated as any Java compiler, and Java code can be made just as lean as what's output by the best C++ compiler.

Share this post


Link to post
Share on other sites
Quote:
Original post by Cinder
What's the differences between C++ and Java?

What is mostly used today?
What's fastest?
When was Java created?
Which language is most functional?
What do I learn most from?
What language are used for console games?

other things..?


There're my answers:
1)C++ has a lot of legacy code. Since it could be considered and extension of C (well, not exactly, but come on...) you have in addition a lot of C programs (think to pretty all *nix apps). Today C# targets pretty the same usage of Java, so perhaps Java is loosing (in percentage) a bit (not sure, anyway).

2)C++ programs are faster, at least in my experience (try using NetBeans or OpenOffice and compare them to, i.e. Visual Studio and MS Office). But in many cases it does not count so much, since you have powerful systems and many programs wouldn't suffer too much even if they run at half speed of a c++ counterpart. (except NetBeans :-(
But I wouln't suggest 3d games or ray-tracers in Java, if the speed is important.
On the other hand, the development speed is usually higher with Java than with C++, due to a very large api that covers all aspects of sw development and sue to a smaller probability of making some errors that in c++ could lead to hours of debug.

3)1994? It was designed to be used with embedded systems, but then...

4)They can do pretty the same things. But, for example, don't expect to go to the hw in a java program (i.e. I don't think that a driver can be made in java).

5)I would say C++, for the following reasons: java forces you to use OO design, if not in your very code (but still, you need a Object Based approach) at least every time you access its api. C++ is a multi-paradigm language: you can use it in a imperative way (like C, Pascal,...) or in a OO way, because it supports OO, but does not require it. In addition, many of the errors you get when you program in C++ may teach you a lot of things , in the learning phase. Moreover, c++ lets you work with the very byte (even bit) without using tricks (i.e. bitfields vs. bitwise operators) and you can get an idea about how does the pc works when you use c++ (stack, buffer overflow, C-like strings, many parameter passing methods [by value, pointer and reference],...).
That's said, I learned a lot about SW design since I began to use Java, and now this helps me even with c++.

6)Don't know, but I'm pretty sure C++.

I would suggest to give a look to both of them, then start a bit with C++, and then choose what you think is best for your needs. I think that knowing a imperative language helps a lot in learning Java, because I suspect that with Java a newbie can easily confuse what is a 'programming language' and what is a 'programming paradigm', or he may think that the provided api IS the language, just because you do nothing without it, while in C++ FIRST start to use the language, THEN begin to use the api. But perhaps that's just me.

Share this post


Link to post
Share on other sites

This topic is 4421 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Guest
This topic is now closed to further replies.
Sign in to follow this