1 / 14

CIS 103 – Programming Logic and Design

CIS 103 – Programming Logic and Design. Java PAL. Java Development Kit. Contains the development kit and the runtime environment ( aka the Java Virtual Machine ) Download Link: http://java.sun.com/javase/downloads/index.jsp Installation

Télécharger la présentation

CIS 103 – Programming Logic and Design

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CIS 103 – Programming Logic and Design Java PAL

  2. Java Development Kit • Contains the development kit and the runtime environment ( aka the Java Virtual Machine ) • Download Link: http://java.sun.com/javase/downloads/index.jsp • Installation • Detailed instructions in the “Read This Before You Begin” section. • Environment Variables • Path • Classpath

  3. The Java Programming Language • Originally was to be called “Oak” • Open Source Software ( free!! )

  4. Platforms • Mainframes, minicomputers, servers, desktops, notebooks, mobile devices, intelligent consumer devices • Windows, Linux, Unix, Macintosh, etc.

  5. Java API • Application Programming Interface • Class Library • Packages • Classes • Methods • Statements • http://java.sun.com/javase/6/docs/api/

  6. Java Applications • Application • A stand-alone program that runs on a computer. • Applet • An applet is a Java program that is executed and viewed in a browser ( IE, Firefox, Navigator, etc. ) • Servlet • A servlet is a Java program that runs on a Web server or application server and provides server-side processing such as accessing a database and e-commerce transactions.

  7. Objects • An object represents something in the real world, such as a car, an employee, or an item in an inventory. • Objectsencapsulateattributes and behavior • An attribute is a piece of information • A behavior is an operation that may be used to manipulate the value of an attribute

  8. Objects • Reusable software components that model real-world items • Look all around you • People, animals, plants, cars, etc. • Attributes • Size, shape, color, weight, etc. • Behaviors • Babies cry, crawl, sleep, etc. • Even though Java is an object-oriented programming language, we will be doing procedural programming using the language. In the CIS 182/282 courses you will explore object-oriented programming in Java.

  9. Java Development • Java programs go through five phases: • Edit • Programmer writes program using an editor; stores program on disk with the .java file name extension • Compile • Use javac (the Java compiler) to create bytecodes from source code program; bytecodes stored in .class files • Load • Class loader reads bytecodes from .class files into memory • Verify • Bytecode verifier examines bytecodes to ensure that they are valid and do not violate security restrictions • Execute • Java Virtual Machine (JVM) uses a combination of interpretation and just-in-time compilation to translate bytecodes into machine language

  10. Classes • Classes are the fundamental unit of programming in Java. • Classes may be composed of: • variables corresponds to attributes • methods corresponds to behaviours

  11. Simple Java Class Example public class HelloWorld { public static void main(String args[]) { System.out.println(“Hello World!”); } } • class is: HelloWorld • method is: main • header: public static void main(String args[])

  12. Java Class Translation • A translator translates a program (class) in one language into another (often a machine language). • A translator may be a: • compiler translate only • interpreter translate and execute • Java uses both a compiler and an interpreter ( as do applications in the Visual Studio environment )

  13. Java .class Files • If you successfully compile a Java class, you produce a class file. This is a file with the same name as the program but with a .class extension • A Class file contains an intermediate language or virtual machine language. In Java this intermediate language is called bytecode.

More Related