SlideShare a Scribd company logo
1 of 13
Chad
November 9, 2010
Java or C++?
Agenda
1) Brief introduction
2) Where They’re Used
3) Input and Output
4) Classes
5) Some key differences
6) My verdict
7) Your Thoughts
They’re the same, but different…
http://www.stumbleupon.com/su/2Ss0d1/jeez.eu/2009/11/03/if-programminglanguages-
were-real-persons/
Where they’re used
I know we talked about “how many students go
on to become computer scientists”, but maybe
after you survey the class, they might have
interest in something that one of the languages
caters to.
 Java widely used for web applets(web design),
and networking
 C++ more in industry (could link in xbox gaming
like Tec. Voc.)
Input and output
Java
import java.io.* ;
BufferedReader reader = new BufferedReader;
try
{ String firstName = reader.readLine(); }
catch (IOException error)
{ System.out.println("Error reading line"); }
System.out.println(“I typed a lot to get this sentence”)
Or…
import java.io.* ;
input =
JOptionPane.showInputDialog(“Something here”)
…What?
Input and output
C++
cout<< “that was easy”;
cin>> someVariable
string input;
getline (cin, input); // now input equals what you
//type in
Classes
SLO 4.7.3
“Create a program using objects and create classes using an
object-oriented programming language.”
 Java is usually considered more of an Object
Oriented Programming Language – do objects
and classes make more sense in java?
 C++ is “C with Classes” – are classes more
intuitive in it?
Classes – C++
 Classes are set up almost like the “recipes” we’ve
seen earlier
class docsClass
{
public:
docsClass();
legendOfCrappa();
void blog(double length, bool isItGood);
private:
bool danishCart;
string researchPaper;
};
 Does this make setting it up easier..or messier later?
Classes -- Java
 Java classes physically contain all of their
methods within them.
 May make it easier to keep classes together?
class School{
private string name;
public school(String name)
{
this.name = name;
}
…more methods inside
}
Other Key differences (favouring java)
• Garbage Programming… and cleaning it up
• ArrayOutOfBounds….. KABOOM
Which is better?…
Your Thoughts and Questions

More Related Content

Similar to Java or c++

Golang #5: To Go or not to Go
Golang #5: To Go or not to GoGolang #5: To Go or not to Go
Golang #5: To Go or not to GoOliver N
 
OBJECT ORIENTED ROGRAMMING With Question And Answer Full
OBJECT ORIENTED ROGRAMMING With Question And Answer  FullOBJECT ORIENTED ROGRAMMING With Question And Answer  Full
OBJECT ORIENTED ROGRAMMING With Question And Answer FullManas Rai
 
Java - A broad introduction
Java - A broad introductionJava - A broad introduction
Java - A broad introductionBirol Efe
 
what is java.pdf
what is java.pdfwhat is java.pdf
what is java.pdfXanGwaps
 
node.js: Javascript's in your backend
node.js: Javascript's in your backendnode.js: Javascript's in your backend
node.js: Javascript's in your backendDavid Padbury
 
20 Years of Java - Story of HER life
20 Years of Java - Story of HER life20 Years of Java - Story of HER life
20 Years of Java - Story of HER lifeStojan Peshov
 
Wire It 0.5.0 Presentation
Wire It 0.5.0 PresentationWire It 0.5.0 Presentation
Wire It 0.5.0 PresentationEric Abouaf
 
javacourse in c.pdf
javacourse in c.pdfjavacourse in c.pdf
javacourse in c.pdfsnehawork
 
javacourse in c.pdf
javacourse in c.pdfjavacourse in c.pdf
javacourse in c.pdfsnehawork
 
Java Semimar Slide (Cetpa)
Java Semimar Slide (Cetpa)Java Semimar Slide (Cetpa)
Java Semimar Slide (Cetpa)Pratima Parida
 
Java Semimar Slide (Cetpa)
Java Semimar Slide (Cetpa)Java Semimar Slide (Cetpa)
Java Semimar Slide (Cetpa)Pratima Parida
 
01. Introduction to programming with java
01. Introduction to programming with java01. Introduction to programming with java
01. Introduction to programming with javaIntro C# Book
 
Java introduction
Java introductionJava introduction
Java introductionSagar Verma
 
best java training center in chennai
best java training center in chennaibest java training center in chennai
best java training center in chennaisathis est
 

Similar to Java or c++ (20)

Java
JavaJava
Java
 
Golang #5: To Go or not to Go
Golang #5: To Go or not to GoGolang #5: To Go or not to Go
Golang #5: To Go or not to Go
 
OBJECT ORIENTED ROGRAMMING With Question And Answer Full
OBJECT ORIENTED ROGRAMMING With Question And Answer  FullOBJECT ORIENTED ROGRAMMING With Question And Answer  Full
OBJECT ORIENTED ROGRAMMING With Question And Answer Full
 
Java - A broad introduction
Java - A broad introductionJava - A broad introduction
Java - A broad introduction
 
what is java.pdf
what is java.pdfwhat is java.pdf
what is java.pdf
 
Java basics
Java basicsJava basics
Java basics
 
1 .java basic
1 .java basic1 .java basic
1 .java basic
 
node.js: Javascript's in your backend
node.js: Javascript's in your backendnode.js: Javascript's in your backend
node.js: Javascript's in your backend
 
20 Years of Java - Story of HER life
20 Years of Java - Story of HER life20 Years of Java - Story of HER life
20 Years of Java - Story of HER life
 
DSLs in JavaScript
DSLs in JavaScriptDSLs in JavaScript
DSLs in JavaScript
 
Wire It 0.5.0 Presentation
Wire It 0.5.0 PresentationWire It 0.5.0 Presentation
Wire It 0.5.0 Presentation
 
javacourse in c.pdf
javacourse in c.pdfjavacourse in c.pdf
javacourse in c.pdf
 
javacourse in c.pdf
javacourse in c.pdfjavacourse in c.pdf
javacourse in c.pdf
 
Java Semimar Slide (Cetpa)
Java Semimar Slide (Cetpa)Java Semimar Slide (Cetpa)
Java Semimar Slide (Cetpa)
 
Java Semimar Slide (Cetpa)
Java Semimar Slide (Cetpa)Java Semimar Slide (Cetpa)
Java Semimar Slide (Cetpa)
 
Introduction of java
Introduction  of javaIntroduction  of java
Introduction of java
 
01. Introduction to programming with java
01. Introduction to programming with java01. Introduction to programming with java
01. Introduction to programming with java
 
Java introduction
Java introductionJava introduction
Java introduction
 
java slides
java slidesjava slides
java slides
 
best java training center in chennai
best java training center in chennaibest java training center in chennai
best java training center in chennai
 

Java or c++

  • 2. Agenda 1) Brief introduction 2) Where They’re Used 3) Input and Output 4) Classes 5) Some key differences 6) My verdict 7) Your Thoughts
  • 3. They’re the same, but different… http://www.stumbleupon.com/su/2Ss0d1/jeez.eu/2009/11/03/if-programminglanguages- were-real-persons/
  • 4. Where they’re used I know we talked about “how many students go on to become computer scientists”, but maybe after you survey the class, they might have interest in something that one of the languages caters to.  Java widely used for web applets(web design), and networking  C++ more in industry (could link in xbox gaming like Tec. Voc.)
  • 5. Input and output Java import java.io.* ; BufferedReader reader = new BufferedReader; try { String firstName = reader.readLine(); } catch (IOException error) { System.out.println("Error reading line"); } System.out.println(“I typed a lot to get this sentence”)
  • 6. Or… import java.io.* ; input = JOptionPane.showInputDialog(“Something here”) …What?
  • 7. Input and output C++ cout<< “that was easy”; cin>> someVariable string input; getline (cin, input); // now input equals what you //type in
  • 8. Classes SLO 4.7.3 “Create a program using objects and create classes using an object-oriented programming language.”  Java is usually considered more of an Object Oriented Programming Language – do objects and classes make more sense in java?  C++ is “C with Classes” – are classes more intuitive in it?
  • 9. Classes – C++  Classes are set up almost like the “recipes” we’ve seen earlier class docsClass { public: docsClass(); legendOfCrappa(); void blog(double length, bool isItGood); private: bool danishCart; string researchPaper; };  Does this make setting it up easier..or messier later?
  • 10. Classes -- Java  Java classes physically contain all of their methods within them.  May make it easier to keep classes together? class School{ private string name; public school(String name) { this.name = name; } …more methods inside }
  • 11. Other Key differences (favouring java) • Garbage Programming… and cleaning it up • ArrayOutOfBounds….. KABOOM
  • 13. Your Thoughts and Questions