Is Java better than C++?

ATI LoVeR 8500

New member
I've heard alot about this. I heard C++ sucks as it isn't cross platform, and is faster than Java. Can anybody tell be why Java sucks?
 
C++ is cross platform.. I hate Java desktop applications.. most of them are slow, and the GUI is ugly
 
Re: Is Java better than C++?

ATI LoVeR 8500 said:
I've heard alot about this. I heard C++ sucks as it isn't cross platform, and is faster than Java. Can anybody tell be why Java sucks?

Depends on how you program your program in C++. If you program to common headers than it can be a simple recompile, but if you program to a specific non compatible platform then its more than a recompile. Java is programed to a virtual machine and the virtual machine translates the program to native machine code. This is where the speed issue comes into play. In my opinion, Java is great for Web based applications and for common program interfaces such as database front ends. I like both C++ and Java.


Jim
 
Lindset said:
C++ is cross platform.. I hate Java desktop applications.. most of them are slow, and the GUI is ugly

Depends on who did the application. If you are talking about IBM and Oracle front ends then I agree, but I have seen some applications that will blow your mind.

Jim
 
Java Rocks

Java Rocks

Actually the real value of Java shines when creating web applications. The ability to use a Java app on either a windows server/linux server/mac server is a great ability. You won't have to remake the program and that saves time and money. You can then even sell that app to another company and not have to worry about implementation problems. Just remember to use normal java api's. C++ is extremely powerfull but does require a much stronger programming knowlegde as there is no built in "garbage collection". If you don't know what that means then Java is a better language to learn first, then you can switch to C++. In the end I guess it comes down to the program you are writing. If you want scalability and ease of implementation with xplatform usability then use Java for it. It the app needs pure speed and is platform specific and you know the c++ language very well then stick with c++. All this ofcourse is IMHO and open for comment, or concern
 
Re: Re: Is Java better than C++?

Re: Re: Is Java better than C++?

jimmt said:
Depends on how you program your program in C++. If you program to common headers than it can be a simple recompile, but if you program to a specific non compatible platform then its more than a recompile. Java is programed to a virtual machine and the virtual machine translates the program to native machine code. This is where the speed issue comes into play. In my opinion, Java is great for Web based applications and for common program interfaces such as database front ends. I like both C++ and Java.


There is also the pre-compilation phase in C++ which takes into account the #ifdef keywords. You can write one single source code and define platform specific includes or instructions between these, and then tell the compiler with ifdef token is to be used for the actual compilation, for instance, #ifdef __LINUX_... etc.

Very handy.
 
I can't even begin to think of an anology to how rediculous this question is. read up on the 2 languages and you will see that they exist for 2 very different reasons, and handle very different tasks.
 
Reverend_bel said:
I can't even begin to think of an anology to how rediculous this question is. read up on the 2 languages and you will see that they exist for 2 very different reasons, and handle very different tasks.

Java = Web Crap

C++ = Applications

But as a language which is better. I didn't phrase my question right. Doesn't Java have a huge, complicated library? And isn't it slow as hell compared to flash when doing things on the web?
 
Actually java is really good for beginners like me as its synthaxe make it easy to understand.
I for one spend over 20 hours a week coding java, since it's my biggest hobby besides women and video games :D

http://javademo.netfirms.com/snowing.html
http://javademo.netfirms.com/trackingeyes.html
http://javademo.netfirms.com/timeDate.html
http://javademo.netfirms.com/drawTriangle.html
http://javademo.netfirms.com/Testing.html
http://javademo.netfirms.com/trackinglines.html
http://javademo.netfirms.com/camera.html
http://javademo.netfirms.com/morph.html
http://javademo.netfirms.com/xFiles.html
http://javademo.netfirms.com/paint.html
http://javademo.netfirms.com/spiralColor.html

Pretty much simple stuff you might think :D

y1Rect[a] = (int)(((double)((getSize().height - rectHeight[a])/2 - yCenter)/(double)(xCenter - (getSize().width - rectWidth[a])/2))*((getSize().width - rectWidth[a])/2 - x1Rect[a]) + (getSize().height - rectHeight[a])/2);
y2Rect[a] = (int)(-((double)((getSize().height - rectHeight[a])/2 - yCenter)/(double)(xCenter - (getSize().width - rectWidth[a])/2))*((getSize().width - rectWidth[a])/2 - x1Rect[a])+ (getSize().height - rectHeight[a])/2 + rectHeight[a]);
 
RageOnator said:
Go have a whinge about it in the Mac forum...

Java sux, vb.net rulz
Can you look at my eyes and repeat that again?
avatar.php
 
Re: Is Java better than C++?

That's kind of like asking "Is a hammer better than a screwdriver?" You chose the tool for the job that needs to be done.

Chris.
 
Onde Pik said:
Wrong. C++ sucks for alot of things. There are still many places where high level languages are pretty useless.

Ihmo c++ is quite good as it allows combining assembler, c and c++ functions - which is not doable with any other language. Sure it produces shittier code than assembler - usually, but sometimes it actually does job better than what you would do with assembler. C++ compilers do sse/sse2/3dnow/mmx optimizations, which would take forever to implement by hand. For now c++ is propably the best choise for performance freaks that dont have time to write same function n + 1 times to make it support all possible optimizations.
 
My main beef Java is the programmer main lack of control over the app itself.

For example, you can allocate memory but only the garbage collector can reclaim it (while in C++ you can allocate and deallocate at will).

In Java, you are practically using pointers everywhere, but they are NOT treated like pointers (which makes it difficult to determine which methods have complete control over objects) and where copy constructors end up getting called.

In Java, passing by reference is virtually non-existent. You can still do it, but it requires more legwork than what you need to do in C++. You cannot do double inheritance in Java, period. In C++, you can do it, and most likely will do many times.

The same goes for pointers to functions. Yes, Java has it. But it is far more complicated to use in Java than in C++.

I may be wrong, but you also cannot define class operators in Java for you new classes.

As a previous poster mentioned, C++ source code is cross platform compatible if you program it right (but of course, you must recompile on that other machine).

Edit: I have never seen StarOffice run faster than MSOffice.
 
Last edited:
snowwhite said:
Ihmo c++ is quite good as it allows combining assembler, c and c++ functions - which is not doable with any other language. Sure it produces shittier code than assembler - usually, but sometimes it actually does job better than what you would do with assembler. C++ compilers do sse/sse2/3dnow/mmx optimizations, which would take forever to implement by hand. For now c++ is propably the best choise for performance freaks that dont have time to write same function n + 1 times to make it support all possible optimizations.

As far as better code, it all depends on the programmer for ASM code whereas with C or C++ it has some leeway for mediocre programmers. For large projects it's like building a house with jewelers tools, 'tho :p Personally I loved to play with assembler in the old DOS days and mess with the hardware directly, but since Windows came in that's been more or less eliminated :(

Chris.
 
Back
Top