SlideShare a Scribd company logo
1 of 10
Migrating from C++ to Java
a path to eternity
The Differences
 C++ features not supported by Java
 Features unique to Java
 Shared features which differ
between C++ and Java
What Java lacks
• Pointers
For security reasons
• Structures or unions
Class is enough
• Operator overloading
Ambiguity. Causes more troubles than benefit
• Preprocessor or preprocessor directive
It’s relevance is worth eliminating
• Automatic Type conversions
Loss of precision
• Concept of Global Variables/Functions
Entire code is encapsulated to classes
• Default Arguments
Not an ideal approach
• Multiple Inheritance
Is done using interfaces
• Destructors
Instead finalize() is used
• The << and >> operators
Since operator overloading is not supported in Java
• Passing objects by value
To eliminate ambiguity
+the keywords
abstract, super, typedef, unsigned int,
goto, delete
What Java Gains
• Threads
Multithreading allows two or more pieces of the same
program to execute concurrently and is supported by Java
language itself.
• Packages
Constructing and using a class library was not this easier yet.
• Interfaces
Used to implement multiple inheritance. no instance of Interfaces
can be created. Similar to Abstract classes in C++.
• Sophisticated memory management technique
When the last reference to an object is destroyed, the object itself
will be deleted on the very next garbage collection.
• API Classes
Substitutes C++ class library.API classes are completely
object oriented.
• Enhanced break and continue
Could accept labels as targets.
• Unicode
Java character set contains 16-bit wide Unicode
characters ensures code portability.
• >>> operator
Performs unsigned right shift
• The documentation comment
Delimited using /** and */
• The String data type
Helps handle strings in an easy and convenient way
+a fully object oriented platform independent
programming concept.
What’s in Common
• Boolean
In C++ everything except zero will be treated as TRUE, but java
won’t!
• Access Specifier
It’s impossible to assign access specifiers to a group of java
variable declarations.
• Exception Handling
In java, the whole syntax part is similar to C++, but a catch block is
mandatory for a thrown exception.
Let’s see in what ways these stuff are going to alter the Java
counterpart of a previously written C++ program…
Eliminating Pointers
Converting Pointer parameters JC
Converting pointers that operate on arrays JC
C++ Reference parameters Vs Java Reference param JC
Converting C++ Abstract classes into Java Interfaces JC
Converting Default Arguments JC
Converting C++ Multiple inheritance hierarchies. eg
Destructors Vs Finalization JC
The Key Aspects
Ref er ence
Java2 Complete Reference
http://java.sun.com/
http://www.scs.carleton.ca
Danks!

More Related Content

What's hot (20)

Constructors and Destructors
Constructors and DestructorsConstructors and Destructors
Constructors and Destructors
 
Java Data Types
Java Data TypesJava Data Types
Java Data Types
 
C by balaguruswami - e.balagurusamy
C   by balaguruswami - e.balagurusamyC   by balaguruswami - e.balagurusamy
C by balaguruswami - e.balagurusamy
 
Characteristics of oop
Characteristics of oopCharacteristics of oop
Characteristics of oop
 
Constructor in java
Constructor in javaConstructor in java
Constructor in java
 
Inline function
Inline functionInline function
Inline function
 
classes and objects in C++
classes and objects in C++classes and objects in C++
classes and objects in C++
 
OOP java
OOP javaOOP java
OOP java
 
Java exception handling
Java exception handlingJava exception handling
Java exception handling
 
9. Input Output in java
9. Input Output in java9. Input Output in java
9. Input Output in java
 
Applets in java
Applets in javaApplets in java
Applets in java
 
Java Exception handling
Java Exception handlingJava Exception handling
Java Exception handling
 
Control Flow Statements
Control Flow Statements Control Flow Statements
Control Flow Statements
 
Final keyword in java
Final keyword in javaFinal keyword in java
Final keyword in java
 
Arrays in java
Arrays in javaArrays in java
Arrays in java
 
Class and object in C++
Class and object in C++Class and object in C++
Class and object in C++
 
Strings in Java
Strings in JavaStrings in Java
Strings in Java
 
Preprocessor in C
Preprocessor in CPreprocessor in C
Preprocessor in C
 
Exception Handling in JAVA
Exception Handling in JAVAException Handling in JAVA
Exception Handling in JAVA
 
Introduction to c++ ppt 1
Introduction to c++ ppt 1Introduction to c++ ppt 1
Introduction to c++ ppt 1
 

Viewers also liked (20)

C++vs java
C++vs javaC++vs java
C++vs java
 
Java vs. C/C++
Java vs. C/C++Java vs. C/C++
Java vs. C/C++
 
Difference between Java and c#
Difference between Java and c#Difference between Java and c#
Difference between Java and c#
 
C++ vs C#
C++ vs C#C++ vs C#
C++ vs C#
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to java
 
Object+oriented+programming+in+java
Object+oriented+programming+in+javaObject+oriented+programming+in+java
Object+oriented+programming+in+java
 
Java buzzwords
Java buzzwordsJava buzzwords
Java buzzwords
 
Zulu Embedded Java Introduction
Zulu Embedded Java IntroductionZulu Embedded Java Introduction
Zulu Embedded Java Introduction
 
Introduction to java and oop
Introduction to java and oopIntroduction to java and oop
Introduction to java and oop
 
C++ to java
C++ to javaC++ to java
C++ to java
 
Python basic
Python basicPython basic
Python basic
 
3rd june
3rd june3rd june
3rd june
 
Dot net guide for beginner
Dot net guide for beginner Dot net guide for beginner
Dot net guide for beginner
 
C sharp
C sharpC sharp
C sharp
 
Beginning Java for .NET developers
Beginning Java for .NET developersBeginning Java for .NET developers
Beginning Java for .NET developers
 
Php i basic chapter 3
Php i basic chapter 3Php i basic chapter 3
Php i basic chapter 3
 
A comparison between C# and Java
A comparison between C# and JavaA comparison between C# and Java
A comparison between C# and Java
 
Microsoft C# programming basics
Microsoft C# programming basics  Microsoft C# programming basics
Microsoft C# programming basics
 
java vs C#
java vs C#java vs C#
java vs C#
 
2.overview of c#
2.overview of c#2.overview of c#
2.overview of c#
 

Similar to Difference between C++ and Java

Similar to Difference between C++ and Java (20)

Introduction to java
Introduction to java Introduction to java
Introduction to java
 
Java Fundamentals in Mule
Java Fundamentals in MuleJava Fundamentals in Mule
Java Fundamentals in Mule
 
Difference between java and c#
Difference between java and c#Difference between java and c#
Difference between java and c#
 
01intro
01intro01intro
01intro
 
Introduction to Java
Introduction to JavaIntroduction to Java
Introduction to Java
 
Java Introduction
Java IntroductionJava Introduction
Java Introduction
 
java tutorial for beginner - Free Download
java tutorial for beginner - Free Downloadjava tutorial for beginner - Free Download
java tutorial for beginner - Free Download
 
2CPP02 - C++ Primer
2CPP02 - C++ Primer2CPP02 - C++ Primer
2CPP02 - C++ Primer
 
Java basics at Lara Technologies
Java basics at Lara TechnologiesJava basics at Lara Technologies
Java basics at Lara Technologies
 
Introduction to java
Introduction to java Introduction to java
Introduction to java
 
Introduction to java
Introduction to java Introduction to java
Introduction to java
 
Java Basics
Java BasicsJava Basics
Java Basics
 
Java Basics in Mule
Java Basics in MuleJava Basics in Mule
Java Basics in Mule
 
Java in Mule
Java in MuleJava in Mule
Java in Mule
 
Java. converted (2)
Java. converted (2)Java. converted (2)
Java. converted (2)
 
Java9to19Final.pptx
Java9to19Final.pptxJava9to19Final.pptx
Java9to19Final.pptx
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to java
 
java.pptx
java.pptxjava.pptx
java.pptx
 
Java basic
Java basicJava basic
Java basic
 
C#
C#C#
C#
 

Recently uploaded

The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 

Recently uploaded (20)

DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 

Difference between C++ and Java

  • 1. Migrating from C++ to Java a path to eternity
  • 2. The Differences  C++ features not supported by Java  Features unique to Java  Shared features which differ between C++ and Java
  • 3. What Java lacks • Pointers For security reasons • Structures or unions Class is enough • Operator overloading Ambiguity. Causes more troubles than benefit • Preprocessor or preprocessor directive It’s relevance is worth eliminating • Automatic Type conversions Loss of precision
  • 4. • Concept of Global Variables/Functions Entire code is encapsulated to classes • Default Arguments Not an ideal approach • Multiple Inheritance Is done using interfaces • Destructors Instead finalize() is used • The << and >> operators Since operator overloading is not supported in Java • Passing objects by value To eliminate ambiguity +the keywords abstract, super, typedef, unsigned int, goto, delete
  • 5. What Java Gains • Threads Multithreading allows two or more pieces of the same program to execute concurrently and is supported by Java language itself. • Packages Constructing and using a class library was not this easier yet. • Interfaces Used to implement multiple inheritance. no instance of Interfaces can be created. Similar to Abstract classes in C++. • Sophisticated memory management technique When the last reference to an object is destroyed, the object itself will be deleted on the very next garbage collection.
  • 6. • API Classes Substitutes C++ class library.API classes are completely object oriented. • Enhanced break and continue Could accept labels as targets. • Unicode Java character set contains 16-bit wide Unicode characters ensures code portability. • >>> operator Performs unsigned right shift • The documentation comment Delimited using /** and */ • The String data type Helps handle strings in an easy and convenient way +a fully object oriented platform independent programming concept.
  • 7. What’s in Common • Boolean In C++ everything except zero will be treated as TRUE, but java won’t! • Access Specifier It’s impossible to assign access specifiers to a group of java variable declarations. • Exception Handling In java, the whole syntax part is similar to C++, but a catch block is mandatory for a thrown exception. Let’s see in what ways these stuff are going to alter the Java counterpart of a previously written C++ program…
  • 8. Eliminating Pointers Converting Pointer parameters JC Converting pointers that operate on arrays JC C++ Reference parameters Vs Java Reference param JC Converting C++ Abstract classes into Java Interfaces JC Converting Default Arguments JC Converting C++ Multiple inheritance hierarchies. eg Destructors Vs Finalization JC The Key Aspects
  • 9. Ref er ence Java2 Complete Reference http://java.sun.com/ http://www.scs.carleton.ca