1 / 19

CSC 8600 Object-Oriented Design & Programming John Lewis Villanova University

CSC 8600 Object-Oriented Design & Programming John Lewis Villanova University. Overview of Course. Java Basics; Java vs. C and C++ Core OO Concepts objects and classes API support and class libraries encapsulation, visibility, static modifier

Download Presentation

CSC 8600 Object-Oriented Design & Programming John Lewis Villanova University

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. CSC 8600 Object-Oriented Design & Programming John Lewis Villanova University

  2. Overview of Course • Java Basics; Java vs. C and C++ • Core OO Concepts • objects and classes • API support and class libraries • encapsulation, visibility, static modifier • inheritance, class hierarchies, abstract classes • interfaces, polymorphism • The Java I/O Model; Exceptions; Internationalization • Applets; Graphics; Threads

  3. Overview of Course • Graphical User Interfaces; Events; The AWT API • AWT Components; Layout Managers • The Swing API; Swing Components • Network Communication; Client/Server; The RMI API • Native Programs; The JNI API • Database Interaction; The JDBC API

  4. Java’s Popularity • Language design • Web-based execution • Buzzword compliant: • simple • object-oriented • pure (versus hybrid) • distributed • interpreted • architecture-neutral • multi-threaded • dynamic • safe

  5. Java Buzzwords • Simple • compared to C and C++ • not when compared to HTML • Object-Oriented • objects and classes are fundamental • Pure vs. Hybrid • pure: the object model is all but forced • hybrid: a mix of the object-oriented and procedural models

  6. Java Buzzwords • Architecture-Neutral • consistency across platforms for language issues • low level representation (bytecode) is not tied to a particular processor type • Interpreted • the bytecode is usually interpreted during execution • Dynamic • classes and library support are dynamically loaded as needed

  7. Java Buzzwords • Distributed • built-in and API support for distributed processing • Threaded • built-in thread control • Safe • concerns regarding client execution of unknown code • references as “safe pointers”

  8. Comparing Java to C and C++ • Java is superficially similar to both C and C++ • Similar syntax and reserved words • Similar control structures • if, if-else, switch • while, do, for • Similar method definition structure • But several other basics and many key underlying concepts are quite different

  9. Java Reserved Words abstract boolean break byte byvalue case cast catch char class const continue default do double else extends false final finally float for future generic goto if implements import inner instanceof int interface long native new null operator outer package private protected public rest return short static super switch synchronized this throw throws transient true try var void volatile while

  10. Java Data • There are two basic data type categories: • primitive data • references to objects • Primitive data types are built into the language • Integers: byte, short, int, long • Floating Point: float, double • Character: char • Boolean: boolean

  11. Java Data • All numeric primitive types are signed and have a fixed size for all platforms: byte 8 bits float 32 bits short 16 bits double 64 bits int 32 bits char 16 bits long 64 bits boolean ? bits

  12. Java Data • Characters are based on the Unicode character set • international • 16 bits per character • ASCII is a subset • Explicit boolean type • conditions must produce boolean results • Primitive data are automatically initialized • though compilers tend to check validity of use

  13. Java Comments • Two forms: // comment runs to the end of the line /* comment runs to terminating symbol, across line breaks */ • A special format with tags can be used to create HTML documentation of classes and packages: /** @author John Lewis */

  14. Comparing Java to C and C++ • All non-primitive data are objects • no structs, unions, enums • arrays and strings are objects • Arrays perform automatic bounds checking • Java has a built-in string concatenation operator (+) • No pointer arithmetic or explicit dereferencing • No typedef or preprocessor • No goto statement

  15. Comparing Java to C and C++ • No forward referencing required • No comma operator • No variable-length parameter lists • No optional or const method parameters • The main method cannot return a value • No global (file level) variables

  16. Java Applications • Processing begins with the main method • Each method belongs to, and is defined within, a particular class • A class often contains multiple methods • A program is often made up of many classes • The simplest program has one class and one method

  17. Java Translation and Execution • A Java compiler translates Java source code into a low-level representation called bytecode • Java bytecode is not the machine language for any traditional CPU • An interpreter translates bytecode into machine language and executes it • Therefore the compiler output is not specific to any particular machine • Theoretically: write once, run anywhere

  18. Java Translation and Execution Java source code Java bytecode Java compiler Java interpreter Bytecode compiler Machine code

  19. Applet Translation and Execution local computer Java compiler Java source code Java bytecode Web browser remote computer Java interpreter

More Related