Skip to main content
GameDev.net gamedev.net

PRO Tired of ads? Read GameDev.net ad-free and help keep the community independent with GameDev Pro — $3/month.

Java vs C++

Java vs C++

cgpIce
cgpIce
Dukandia · · 1 min read
3,657 2
Hello,
Right so let us redo this. Java and C++ are very similar in syntax but what really makes them different? I will go over some of the differences in as much detail as I am aware, I will then ask that you post your opinion of what language would be best for a computer game. The results of your opinions, my team's opinions, and the information provided will influence Dukandia's progress.

Design:
Before we can talk about the very in-detail parts of C++ and Java, we must first talk about why they were first created:

  • C++ was designed for systems and applications, it was an extension of the C language. It was designed for efficient procedural execution.
  • Java was designed as a system to interpret printing systems, but later grew to do much more. It uses virtual machine to make it portable and secure. Although it has similar syntax to C++ it is not compatible in any way.


    Compatibility

    • C++ is of course compatible with C, of course exceptions do apply.
    • Java is not compatible with any programming language.


      Portability

      • C++ is write once, compile to run anywhere
      • Java is write once, run anytime anywhere

        Syntax

        • Parsing C++ can be more difficult, C++ allows namespace level functions, variables, ect. Lastly C++ objects are values.
        • Java has a context free grammar that cane be parsed by simple parsers. Java entities must be given a type and be defined as such.

          Running applications

          • C++ is compiled directly into code your operating system can run
          • Java is compiled into code the Java Virtual Machine reads and interprets at run time

            Templates vs. Generics

            • C++ uses Templates
            • Java uses Generics

              I would delve into more detail but I'm not really good at going over everything if anyone wants to step up let me know and I'll add it in.

              That's as much as I know for comparison really.

Discussion

Loading comments...