1. allocating and freeing memory also known as
Briefly discuss the advantages and disadvantages of Java compareto one other OO programming languages (refer to list below). Focus your answer in terms of technologymanagement such as the OO capability, complexity/speed, affordability, andportability. Provide proper referenceswhere applicable. Your short reportshould be around 500 to 1000 words (2 to 4 pages). Examples of OOPlanguages: C++, C#, Visual Basic.NET, PHP, Python, Objective-C etc. Advantages/Disadvantages (C++) Advantages/Disadvantages (JAVA) § C++ is a common purpose programming language developed at the beginning from C programming language.
It was developed by Bjarne Stroustrup at Bell Labs in 1979. § Java is another programming language which has been influenced by the C language. It derives much of its syntax from C and C++. However it has fewer low-level facilities than either. § C++ helps both procedural and object oriented programming language so it is known as a hybrid language. § Java is an object oriented language where everything is defined in terms of class and objects. § C++ was designed for system and application programming extending the C programming language. § Java in most cases was created as an interpreter for printing systems and support network computing.
It is based on a virtual machine to be secure and highly portable. § C++ is not a memory safe language. § Java is a memory safe language which means that mistakes in Java packages are detected in defined ways. § C++ relies on non-standard third party libraries. § Java incorporates preferred libraries for solving specific tasks.
§ C++ uses memory allocation and de-allocation functions. § Java has an automatic system for allocating and freeing memory also known as garbage collection. § C++ supports all data types. § Java does not support the struct, union and pointer data type. § C++ does not have built in support for threads. It relies on third-party libraries for thread support. § Java has built in support for threads. § In terms of performance or speed when you convert optimized C++ to Java, the code is about 3x slower.
C++ is still faster in most operations than Java. § Java at the moment even at low-level and numeric computation. § C++ is normally compiled directly to machine code that is when execution is directly done by the operating system. § Java is normally compiled to byte-code that the Java virtual machine (JVM) then either interprets or JIT compiles to machine code and then executes. § C++ has destructors. § Java has finalizers. Both c++ and java are invoked prior to an object’s deallocation but they differ significantly. § If a class during code changes grows in data size, C++ code has to be recompiled since it’s the instantiator’s task to allocate memory and needs knowledge about size.
§ It not the case in java. It’s easier to keep compatibility. § C++ is a platform-dependent language.
C++ core is platform specific. Although, there are libraries that help to make porting quite easy. § Java is portable. Java provides a true source code portability and CPU architecture portability. § C++ has templates.
§ Java has generics