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!

More Related Content

Viewers also liked (20)

PPT
Dot net guide for beginner
jayc8586
 
PPTX
C sharp
Ahmed Vic
 
PPTX
Beginning Java for .NET developers
Andrei Rinea
 
PPT
Php i basic chapter 3
Muhamad Al Imran
 
PDF
A comparison between C# and Java
Ali MasudianPour
 
PPSX
Microsoft C# programming basics
Prognoz Technologies Pvt. Ltd.
 
PPTX
2.overview of c#
Raghu nath
 
PPT
Difference between C++ and Java
Ajmal Ak
 
PPTX
C sharp
sanjay joshi
 
PPT
Basics of c# by sabir
Sabir Ali
 
PPTX
C vs c++
ZTE Nepal
 
PPT
ASP.NET Session 1
Sisir Ghosh
 
PPTX
Java v/s .NET - Which is Better?
NIIT India
 
PPTX
Java script basic
Vithushan Vinayagamoorthy
 
PDF
Python overview
Hemant Kumar Tiwary
 
PPTX
C# basics
sagaroceanic11
 
PPTX
Java vs .net
Tech_MX
 
PPTX
visual basic .net
ronald_a_go
 
PPTX
Java vs .net (beginners)
Ravi Vishwakarma
 
Dot net guide for beginner
jayc8586
 
C sharp
Ahmed Vic
 
Beginning Java for .NET developers
Andrei Rinea
 
Php i basic chapter 3
Muhamad Al Imran
 
A comparison between C# and Java
Ali MasudianPour
 
Microsoft C# programming basics
Prognoz Technologies Pvt. Ltd.
 
2.overview of c#
Raghu nath
 
Difference between C++ and Java
Ajmal Ak
 
C sharp
sanjay joshi
 
Basics of c# by sabir
Sabir Ali
 
C vs c++
ZTE Nepal
 
ASP.NET Session 1
Sisir Ghosh
 
Java v/s .NET - Which is Better?
NIIT India
 
Java script basic
Vithushan Vinayagamoorthy
 
Python overview
Hemant Kumar Tiwary
 
C# basics
sagaroceanic11
 
Java vs .net
Tech_MX
 
visual basic .net
ronald_a_go
 
Java vs .net (beginners)
Ravi Vishwakarma
 

Similar to C++ to java (20)

PPTX
Introduction to java
princeirfancivil
 
PPTX
Introduction to java
Veerabadra Badra
 
PPTX
Introduction to java
Phaniu
 
PPTX
Introduction to java
javeed_mhd
 
PPTX
C++vsJava.pptx
aniketjadhav341797
 
PPTX
Java Introduction
javeed_mhd
 
PPTX
Java. converted (2)
AVINASHMEHRA6
 
PPTX
C++vs java
Pradeep wolf king
 
PPTX
Introduction to java
sanjay joshi
 
PPTX
Java Basics in Mule
Rajkattamuri
 
PPTX
Java Basics
Khan625
 
PPTX
Java in Mule
Shahid Shaik
 
PPTX
Introduction to java
sanjay joshi
 
PPTX
java tutorial for beginner - Free Download
TIB Academy
 
PPTX
C++ vs java which is best for future
calltutors
 
PPTX
Java Fundamentals in Mule
Anand kalla
 
PDF
Object Oriented Programming using Java..
sumanyadavdpg
 
PPTX
Java Technologies notes of unit 1 and 2.
sumanyadavdpg
 
PPT
Introduction to java new
Gursimranjot singh dhiman
 
PPT
Introduction to java new
Gursimranjot singh dhiman
 
Introduction to java
princeirfancivil
 
Introduction to java
Veerabadra Badra
 
Introduction to java
Phaniu
 
Introduction to java
javeed_mhd
 
C++vsJava.pptx
aniketjadhav341797
 
Java Introduction
javeed_mhd
 
Java. converted (2)
AVINASHMEHRA6
 
C++vs java
Pradeep wolf king
 
Introduction to java
sanjay joshi
 
Java Basics in Mule
Rajkattamuri
 
Java Basics
Khan625
 
Java in Mule
Shahid Shaik
 
Introduction to java
sanjay joshi
 
java tutorial for beginner - Free Download
TIB Academy
 
C++ vs java which is best for future
calltutors
 
Java Fundamentals in Mule
Anand kalla
 
Object Oriented Programming using Java..
sumanyadavdpg
 
Java Technologies notes of unit 1 and 2.
sumanyadavdpg
 
Introduction to java new
Gursimranjot singh dhiman
 
Introduction to java new
Gursimranjot singh dhiman
 
Ad

Recently uploaded (20)

PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PDF
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
PDF
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
PDF
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
PPTX
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PDF
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PDF
July Patch Tuesday
Ivanti
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PDF
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
July Patch Tuesday
Ivanti
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
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