0% found this document useful (0 votes)
10 views8 pages

Module 00 CPP Vs Java Intro Slides

Uploaded by

bekamdawit551
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views8 pages

Module 00 CPP Vs Java Intro Slides

Uploaded by

bekamdawit551
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

How code is executed on a

computer.
Differences between C++ and Java
The Java Virtual Machine
“Bytecode”
Your Java Compiled
Java Compiler
Source Code Java (.class)

Your java code gets compiled into


1 bytecode, and intermediate code that
the virtual machine understands.

Your Java Application


(.class)

Java Virtual Machine (interpreter)


The Java Virtual Machine in a running
2 program that acts an interpreter. It takes Operating System
your program as input and runs it on the
system.
Hardware
Java Overview: Code to execution

Stack Overflow user: displayName


https://stackoverflow.com/a/36394113
CC BY-SA 4.0: https://creativecommons.org/licenses/by-sa/4.0/
Advantage of the Java Virtual Machine
“Write once, run anywhere”

The bytecode is portable to any JVM.


If your system runs the JVM, it can run
your program.

https://www.prepbytes.com/blog/java/java-compilation-process/
The C++
Executable
Your C++ Machine
C++ Compiler
Code code

In C++, your application is compiled into


1 machine code. This means it can run
directly on your system and processer.

Your Application
After compiling your code it becomes an executable (executable code)
program. This means that the machine’s hardware can Operating System
2
directly execute it.

There is interpreter program acting as an intermediary Hardware


C++ Overview: Code to execution

Separate source files will be compiled into “object” files. These


are executable instructions for specific units of the program.

The linker will import library executable code


and other object executable code into the
complete executable program.

https://subscription.packtpub.com/book/programming/9781789801491/1/ch01lvl1sec03/
the-c-compilation-model
Advantages and Disadvantages of Java

Advantages Disadvantages
• The JVM handles memory • Java can be slower than other
management and adds other complied languages.
projection to make programing • Due to its object-oriented
safer and more secure in some style, simple problems require
cases. class boilerplate code. This
• Programs written in Java are makes it a verbose language.
highly portable and can be run • Java runs on a virtual machine
on any machine with a JVM. which makes low level access
to the hardware more difficult.
Advantages and Disadvantages of C++

Advantages Disadvantages
• C++ is one of the most • C++ can be a complicated
performant and efficient language to learn due having
languages since its programs are multiple ways to do similar tasks
compiled into machine code. and similar syntax for different
• C++ allows low level control of task.
the hardware and memory • The programmer has complete
management. control and responsibility for
• It provides support for object- memory management. This often
oriented programming with little leads to bugs due to complexity
overhead. of memory management.

You might also like