SlideShare a Scribd company logo
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!
Ad

More Related Content

Viewers also liked (20)

3rd june
3rd june3rd june
3rd june
Rahat Khanna a.k.a mAppMechanic
 
Python basic
Python basicPython basic
Python basic
Mayur Mohite
 
Dot net guide for beginner
Dot net guide for beginner Dot net guide for beginner
Dot net guide for beginner
jayc8586
 
C sharp
C sharpC sharp
C sharp
Ahmed Vic
 
Beginning Java for .NET developers
Beginning Java for .NET developersBeginning Java for .NET developers
Beginning Java for .NET developers
Andrei Rinea
 
Php i basic chapter 3
Php i basic chapter 3Php i basic chapter 3
Php i basic chapter 3
Muhamad Al Imran
 
A comparison between C# and Java
A comparison between C# and JavaA comparison between C# and Java
A comparison between C# and Java
Ali MasudianPour
 
Microsoft C# programming basics
Microsoft C# programming basics  Microsoft C# programming basics
Microsoft C# programming basics
Prognoz Technologies Pvt. Ltd.
 
java vs C#
java vs C#java vs C#
java vs C#
Shivalik college of engineering
 
2.overview of c#
2.overview of c#2.overview of c#
2.overview of c#
Raghu nath
 
Difference between C++ and Java
Difference between C++ and JavaDifference between C++ and Java
Difference between C++ and Java
Ajmal Ak
 
C sharp
C sharpC sharp
C sharp
sanjay joshi
 
Basics of c# by sabir
Basics of c# by sabirBasics of c# by sabir
Basics of c# by sabir
Sabir Ali
 
C vs c++
C vs c++C vs c++
C vs c++
ZTE Nepal
 
ASP.NET Session 1
ASP.NET Session 1ASP.NET Session 1
ASP.NET Session 1
Sisir Ghosh
 
Java v/s .NET - Which is Better?
Java v/s .NET - Which is Better?Java v/s .NET - Which is Better?
Java v/s .NET - Which is Better?
NIIT India
 
Java script basic
Java script basicJava script basic
Java script basic
Vithushan Vinayagamoorthy
 
Python overview
Python   overviewPython   overview
Python overview
Hemant Kumar Tiwary
 
C# basics
C# basicsC# basics
C# basics
sagaroceanic11
 
Java vs .net
Java vs .netJava vs .net
Java vs .net
Tech_MX
 

Similar to C++ to java (20)

Introduction to java
Introduction to java Introduction to java
Introduction to java
sanjay joshi
 
Java Fundamentals in Mule
Java Fundamentals in MuleJava Fundamentals in Mule
Java Fundamentals in Mule
Anand kalla
 
Difference between java and c#
Difference between java and c#Difference between java and c#
Difference between java and c#
TECOS
 
01intro
01intro01intro
01intro
Waheed Warraich
 
Introduction to Java
Introduction to JavaIntroduction to Java
Introduction to Java
Professional Guru
 
Java Introduction
Java IntroductionJava Introduction
Java Introduction
javeed_mhd
 
java tutorial for beginner - Free Download
java tutorial for beginner - Free Downloadjava tutorial for beginner - Free Download
java tutorial for beginner - Free Download
TIB Academy
 
2CPP02 - C++ Primer
2CPP02 - C++ Primer2CPP02 - C++ Primer
2CPP02 - C++ Primer
Michael Heron
 
Java basics at Lara Technologies
Java basics at Lara TechnologiesJava basics at Lara Technologies
Java basics at Lara Technologies
laratechnologies
 
Introduction to java
Introduction to java Introduction to java
Introduction to java
Phaniu
 
Introduction to java
Introduction to java Introduction to java
Introduction to java
javeed_mhd
 
Java Basics
Java BasicsJava Basics
Java Basics
Khan625
 
Java Basics in Mule
Java Basics in MuleJava Basics in Mule
Java Basics in Mule
Rajkattamuri
 
Java in Mule
Java in MuleJava in Mule
Java in Mule
Shahid Shaik
 
Java. converted (2)
Java. converted (2)Java. converted (2)
Java. converted (2)
AVINASHMEHRA6
 
Java9to19Final.pptx
Java9to19Final.pptxJava9to19Final.pptx
Java9to19Final.pptx
iFour Technolab Pvt. Ltd.
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to java
sanjay joshi
 
java.pptx
java.pptxjava.pptx
java.pptx
PRASHANTKULKARNI133
 
Java basic
Java basicJava basic
Java basic
Pooja Thakur
 
C#
C#C#
C#
Norhan Said
 
Ad

Recently uploaded (20)

Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
 
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath MaestroDev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
UiPathCommunity
 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
 
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath MaestroDev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
UiPathCommunity
 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
Ad

C++ to 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