Lecture 2 Intro To Java - Brief History of Java CMPT 125...

Info icon This preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
CMPT 125: Lecture 2 Introduction to Java Tamara Smyth, [email protected] School of Computing Science, Simon Fraser University January 3, 2009 1 Brief History of Java Java was developed by James Gosling and his team at Sun Computers in the early 1990s. Originally called Oak, later given the name Java: inspired by a coffee bean? or an acronym for the names of the team members: J ames Gosling, A rthur V an Hoff, and A ndy Bechtolsheim? Though now often thought of as a program designed for the world wide web, it was originally meant to be a programming language for embedded systems. As the web gained in popularity in 1994, the HotJava browser was a good demo of Java’s capabilities: platform independence and security. Java released publicly in 1995. CMPT 125: Introduction to Java, Lecture 2 2 Java Versions We will use Java version 1.5 (5.0) which includes some major enhancements to previous versions of Java (so watch out for this if you’re using older textbooks!). Regularly consult the following website (keep it bookmarked!) for the API specification: . CMPT 125: Introduction to Java, Lecture 2 3 Some Java Details Java syntax is (purposely) similar to C/C++ syntax. Java supports the object-oriented programming paradigm (OOP). Because of OOP, some simple programs tend to be overly complex in Java. Java was not designed with beginners in mind, but it is arguably easier to learn than C/C++. Java uses a garbage collector to help manage memory. For some applications Java is a little slower than C/C++ but tends to be much faster than (say) Python. CMPT 125: Introduction to Java, Lecture 2 4
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Translating and Executing Java Programs All source code is first written in plain text files ending with the .java extension. Source files are then compiled to produce .class files. A .class file does not contain code that is native to your processor. Rather, it contains bytecode , the machine language of the Java Virtual Machine (Java VM). The java launcher tool then runs your application with an instance of the Java VM. Figure 1: MyProgram.java is compiled to produce MyProgram.class, which is then inter- preted by the Java VM before My Program runs on a computer. CMPT 125: Introduction to Java, Lecture 2 5 Platform Independence Because the Java VM is available on many different operating systems, the same .class files can run on different computers without recompiling. The Java HotSpot virtual machine, perform additional steps at runtime to give your application a performance boost, including recompiling some frequently used code to native machine code. CMPT 125: Introduction to Java, Lecture 2 6 Compiling and Running Java To compile DrawWin.java from the command line, type C:\> javac DrawWin.java to produce a DrawWin.class file.
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern