Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


C++ or Java To be or not to be??

Posted on 2000-04-29
Medium Priority
Last Modified: 2010-04-16

I have been playing around with Java and C++ for a little while (Visual Studio 6).

In general terms, if I wanted to write a simple dialog based win app, is there any benefit using c++ over Java (or visa versa).

I know its a bit vauge but i'm only really looking for thoughts / opinions on this.
Question by:Ginger_Ed

Expert Comment

ID: 2764863
java is much easier to program and just about as powerful as c++, some may disagree here, but it's also slower to run and requires the computer that's running the app to have a java runtime environment installed

Expert Comment

ID: 2765332

I think C++ is easier! Of course, the language sometimes is difficult, but the IDEs are better, I think!
Look at www.borland.com! Order a Demo-CD and you'll see, the C++Builder is very easy to use!!!
(and creates standalone exes, too)

Author Comment

ID: 2765628
I've got Visual C++ so I'll be using that.

But is there any noticable difference in speed in a small app.  

Also am I right in thinking that the only java runtime they need already comes with win98 / nt / 2000??


Accepted Solution

matth012098 earned 400 total points
ID: 2831157

   Ive programmed in VisualC++ for many years and find that writing software for windows based applications takes a lot of reading the docs, especially using MFC. It can also be quite difficult getting to frips with the way the messaging system works. I have just recently over the last couple of months started to learn Java and I find it much easier to manage. I am a computer games programmer and have written many games in many languages and I must say that I find Java the best for its simplicity and portability. Java could probably never be as fast as something like C++, because C++ compiles straight to native assembly, however companies are now working on hardware implementations of the Java Virtual Machine (JVM), which does come with Windows 98 and can be upgraded from Suns site. These hardware JVM's will allow software that is as competitive if not as good as software for todays native systems. Here are list of advantages and disadvantages of using Java:

Java - Advantages
1. Java can call native code written in C++ via COM
2. Cross platform support, including mobile phones, digital set top boxes, Unix, Windows, DOS, Linux etc.... The code you write will work on any machine that has a JVM and you will not have to rewrite whole lilbraries of code to get it to work.
3. Hardware JVM's in development, bye bye software interpreters
4. Versatile and very very easy to use
5. Excellent support on the net
6. Applications can be written to run in a web browser (ActievX can , but it is generally not as trusted due to its client side access to your information)
7. When your software crashes it doesnt generally take the OS down with it.
8. Fun to write in
9. Windows functionality is part of the huge Java library that comes with it
10. The IDE for VisualJ++ is the same as for VisualC++
11. Free compilers and tools from sun
12. Syntax is very similar to C++, so you could learn both at the same time

Java - Disadvantages
1. Bytecodes (Java assembly) must be interpreted by the JVM so it can be slow for doing things such as advanced calculations, however performing tasks such as blitting images to the screen are implemented in native platform code inside the JVM so they are as fast as C++
2. More work in C++ at the moment, but theres even more work in VB

The above lists are by no means complete, they are simply off the top of my head

C++ and many other languages that compile to native code absolutely faster but they are harder to write in and will fade out in years to come.

Hope this helps



  Heres a small example in Java

class Example
  public static void main(String[] args)
    System.out.println("Hello World");

and in C++ (Well C)

#include <stdio.h>

void main(int argc, char *argv[])
  printf("Hello World\n");

Although noted the above is not encapsulated into any class. If I did this as with the Java implementation then the source would be much longer and complicated.


Author Comment

ID: 2832386
cheers,  I have been playing around and I find Java a hell of a lot easier.

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
When you discover the power of the R programming language, you are going to wonder how you ever lived without it! Learn why the language merits a place in your programming arsenal.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question