COP3337_1 - Review of Java(I Dr Antonio L Bajuelos Note The...

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

1 Review of Java (I) Dr. Antonio L. Bajuelos Note: The most of the information of these slides was extracted and adapted from Horstmann’s book, “Big Java. Early Objects”, 5 th edition. They are provided for COP-3337 students only. Not to be published or publicly distributed without permission by the publisher. 2 The Java Programming Language ° Java was introduced to an enthusiastic crowd at the SunWorld exhibition in 1995 , together with a browser that ran applets. ° Java code that can be located anywhere on the Internet. ° Example: an Applet for Visualizing Molecules Running in a Browser Window ( )
Image of page 1

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

2 3 The Java Programming Language ° Since then, Java has grown at a phenomenal rate. ° Java is easier to use than its closest rival, C++ . ° Java has a rich library that makes it possible to write portable programs that can bypass proprietary operating systems ° The same Java program will run, without change, on Windows , UNIX , Linux , or Macintosh . ° In order to achieve portability, the Java compiler does not translate Java programs directly into CPU instructions. ° Instead, compiled Java programs contain instructions for the Java virtual machine , a program that simulates a real CPU. ° A “micro edition” and an “enterprise edition” of the Java library allow Java programmers to target hardware ranging from smart cards and cell phones to the largest Internet servers. 4 The Java Programming Language ° Java has been extended many times during its life… ° Java 8 was released on 18 March 2014
Image of page 2
3 5 The Java Development Environment ° Example: the Eclipse java development environment. 6 From Source Code to Running Program ° In order to run your program, the Java compiler translates your source files into class files (a class file contains instructions for the Java virtual machine). ° After the compiler has translated your source code into virtual machine instructions , the virtual machine executes them. ° During execution, the virtual machine accesses a library of pre-written code, including the implementations of the System and PrintStream classes that are necessary for displaying the program’s output. ° In some programming environments , the compiler and virtual machine are essentially invisible to the programmer
Image of page 3

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

4 7 From Source Code to Running Program ° The process of creating and running a Java program . 8 The general syntax of a Java program
Image of page 4
5 9 Java: Objects and Classes ° In Java, you build programs from objects . ° An object is an entity that you can manipulate by calling one or more of its methods . ° A method consists of a sequence of instructions that can access the internal data of an object. ° Example: Representation of the System.out Object 10 Java: Objects Construction ° … invoke the new operator, specifying the name of the class and the argument(s)
Image of page 5

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

6 11 Java: the API Documentation ° API Application Programming Interface ° The classes and methods of the Java library are listed in the API documentation ( ) .
Image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.
  • Spring '16
  • francisco

{[ 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