What is Java? Object Oriented Programming Language Sun Microsystems “Write Once, Run Everywhere” Bytecode and Virtual Machine Java Platform (Java VM and Java API)
Java History Started 1991 by Gosling, Sheridan, Naughton (“The Green Team”) Oak for Consumer Electronics Mosaic 1993 March 1995 v1.0a2 Netscape and Java, May 23, 1995
Java As Programming Language Simple Object-Oriented Distributed Interpreted Robust Secure Architecture Neutral Portable High-Performance Multithreaded Dynamic
What you get with Java The essentials: Objects, strings, threads, numbers, input and output, data structures, system properties, date and time, and so on. Applets: The set of conventions used by applets. Networking: URLs, TCP (Transmission Control Protocol), UDP (User Datagram Protocol) sockets, and IP (Internet Protocol) addresses.
Internationalization: Help for writing programs that can be localized for users worldwide. Programs can automatically adapt to specific locales and be displayed in the appropriate language. Security: Both low level and high level, including electronic signatures, public and private key management, access control, and certificates. Software components: Known as JavaBeans, can plug into existing component architectures.
Object serialization: Allows lightweight persistence and communication via Remote Method Invocation (RMI). Java Database Connectivity (JDBC): Provides uniform access to a wide range of relational databases.
Object Oriented Data Structure and behavior are incorprated in discrete objects identity, classification, polymorphism, inheritance Identity: Data is quantized into discrete, distinguishable entities called objects. Classification: Objects with same attributes and behavior are grouped in classes
Class: An abstraction that describes properties important to an application and ignores the rest Instance: Each object is an instance of a class. Polymorphism: Same operation may behave differently on different classes. Specific implementation of an operation is a method. Inheritance: Sharing of attributes and operations among classes based on a hierarchical relationship
OO Development Model Concepts; Not Implementation Analysis System Design Object Design Implementation
Key Themes Abstraction: Focus on the essential, inherent aspects of an entity and ignoring the accidental properties Encapsulation or Information Hiding: Separate the external aspects of an object from the internal implementation details Combine Data and Behavior
Sharing Emphasize object structure not procedural structure Synergy
Hello World
Comments The Java language supports three kinds of comments: /* text */ The compiler ignores everything from /* to */. /** documentation */ This indicates a documentation comment (doc comment, for short). The compiler ignores this kind of comment, just like it ignores comments that use /* and */. The JDK javadoc tool uses doc comments when preparing automatically generated documentation. For more information on javadoc, see the Java tool documentation. // text The compiler ignores everything from // to the end of the line.
Applet
HTML A Simple Program Here is the output of my program: