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”)
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