SlideShare ist ein Scribd-Unternehmen logo
1 von 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!

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

Characteristics of OOPS
Characteristics of OOPS Characteristics of OOPS
Characteristics of OOPS
 
OOP java
OOP javaOOP java
OOP java
 
Inheritance in JAVA PPT
Inheritance  in JAVA PPTInheritance  in JAVA PPT
Inheritance in JAVA PPT
 
Friend function & friend class
Friend function & friend classFriend function & friend class
Friend function & friend class
 
Exception handling in java
Exception handling in javaException handling in java
Exception handling in java
 
Operator overloading
Operator overloadingOperator overloading
Operator overloading
 
Operators in java presentation
Operators in java presentationOperators in java presentation
Operators in java presentation
 
Advance Java Topics (J2EE)
Advance Java Topics (J2EE)Advance Java Topics (J2EE)
Advance Java Topics (J2EE)
 
User defined functions
User defined functionsUser defined functions
User defined functions
 
Constructor
ConstructorConstructor
Constructor
 
Basic Concepts of OOPs (Object Oriented Programming in Java)
Basic Concepts of OOPs (Object Oriented Programming in Java)Basic Concepts of OOPs (Object Oriented Programming in Java)
Basic Concepts of OOPs (Object Oriented Programming in Java)
 
Java Docs
Java DocsJava Docs
Java Docs
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
Polymorphism
PolymorphismPolymorphism
Polymorphism
 
Unary operator overloading
Unary operator overloadingUnary operator overloading
Unary operator overloading
 
Polymorphism in Java
Polymorphism in JavaPolymorphism in Java
Polymorphism in Java
 
LinkedList vs ArrayList in Java | Edureka
LinkedList vs ArrayList in Java | EdurekaLinkedList vs ArrayList in Java | Edureka
LinkedList vs ArrayList in Java | Edureka
 
User defined functions in C
User defined functions in CUser defined functions in C
User defined functions in C
 
Object oriented programming concept
Object oriented programming conceptObject oriented programming concept
Object oriented programming concept
 
Function overloading ppt
Function overloading pptFunction overloading ppt
Function overloading ppt
 

Andere mochten auch

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
 
2.overview of c#
2.overview of c#2.overview of c#
2.overview of c#
Raghu nath
 
ASP.NET Session 1
ASP.NET Session 1ASP.NET Session 1
ASP.NET Session 1
Sisir Ghosh
 
Java vs .net
Java vs .netJava vs .net
Java vs .net
Tech_MX
 

Andere mochten auch (20)

3rd june
3rd june3rd june
3rd june
 
Python basic
Python basicPython basic
Python basic
 
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#
 
Difference between C++ and Java
Difference between C++ and JavaDifference between C++ and Java
Difference between C++ and Java
 
C sharp
C sharpC sharp
C sharp
 
Basics of c# by sabir
Basics of c# by sabirBasics of c# by sabir
Basics of c# by sabir
 
C vs c++
C vs c++C vs c++
C vs c++
 
ASP.NET Session 1
ASP.NET Session 1ASP.NET Session 1
ASP.NET Session 1
 
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?
 
Java script basic
Java script basicJava script basic
Java script basic
 
Python overview
Python   overviewPython   overview
Python overview
 
C# basics
C# basicsC# basics
C# basics
 
Java vs .net
Java vs .netJava vs .net
Java vs .net
 

Ähnlich wie C++ to java

Ähnlich wie C++ to 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#
 

Kürzlich hochgeladen

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Kürzlich hochgeladen (20)

TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 

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