Java-Intro-Spr04 - Introduction to Java COP 3330...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
Introduction to Java COP 3330 Introduction to OO Programming with Java © Dr. David A. Workman School of CS University of Central Florida January 2004
Background image of page 1

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

View Full DocumentRight Arrow Icon
January 2004 (c) Dr. David A. Workman 2 References Object Oriented Software Development Using Java by Xiaoping Jia, Addison-Wesley, 2000; ISBN = 0-201-35084-X Web Sites http://java.sun.com/docs/books/jls/index.html http://java.sun.com/
Background image of page 2
January 2004 (c) Dr. David A. Workman 3 Getting Started The Java Environment Java Object (bytecode) Files Java Compiler (javac) unit-name .java > javac unit-name.java > java main-unit [commandline args] Java Interpreter (java) unit-name .class program input files program output files Java Source Files network Java Interpreter (java) Remote Java enabled browser application applet > setenv CLASSPATH newjavadir :$CLASSPATH > echo $CLASSPATH See notes applet See Notes
Background image of page 3

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

View Full DocumentRight Arrow Icon
January 2004 (c) Dr. David A. Workman 4 Program Building Blocks Classes Classes are the primary building blocks of Java programs (applications & applets) - everything in Java is an instance of some class, including programs - Applications are Java programs that can be compiled and run like any other program in the host OS environment - they have normal access to all host computer resources . Applets, on the other hand, are programs callable from an HTML page , transportable across networks, and executable by a Java-enabled browser; they have restricted access (based on permissions) to the host environment. Interfaces Are similar to class interfaces in C++, but have important differences; interfaces encapsulate a collection of constants and method declarations that are implemented by one or more other classes ; interfaces define and standardize a collection of capabilities shared by all classes that implement the interface. Packages Packages provide a way to group classes, interfaces, and other packages under a single name; package names are identical to the name of the directory in which components of the package are stored in the host file system . Import statements are used in source files to give direct visibility to package components.
Background image of page 4
January 2004 (c) Dr. David A. Workman 5 Program Structure Java Standard Java Library CLASSPATH Libraries Current Directory (default package) Other (Nested) Packages Classes Interfaces 1..* * * Classes * Fields Methods 1..* 1..* File Interface Class (public | pkg) Class (private) * mutually exclusive 1..*
Background image of page 5

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

View Full DocumentRight Arrow Icon
January 2004 (c) Dr. David A. Workman 6 Java Application public class Hello { //the first letter of a class name is upper case, by convention public static void main( String[] args ){ //must be declared like this String user = args[0]; // System is a standard Java class // System.out is a predefined PrintStream object denoting the CRT System.out.println("Hello " + user + '!'); // "+" is concatenation System.out.println("I see you have succeeded in entering the \"Matrix\"!"); }// main method }//Hello Hello.java Escape character is used to embed double-quotes in a string.
Background image of page 6
January 2004 (c) Dr. David A. Workman 7 Things to Remember Java programs are organized as a hierarchical collection of “ package units ( a “Tree” of packages ).
Background image of page 7

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

View Full DocumentRight Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 07/04/2011 for the course COP 3330 taught by Professor Staff during the Summer '08 term at University of Central Florida.

Page1 / 23

Java-Intro-Spr04 - Introduction to Java COP 3330...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online