CSC 224 Java for Programmers - PowerPoint PPT Presentation

1 / 21
About This Presentation
Title:

CSC 224 Java for Programmers

Description:

A Brief History. January 1996: first official release JDK 1.0 ... Examples of string literals: 'watermelon' 'fig' '354' ' ' (space) '' (empty string) ... – PowerPoint PPT presentation

Number of Views:80
Avg rating:3.0/5.0
Slides: 22
Provided by: valued54
Category:

less

Transcript and Presenter's Notes

Title: CSC 224 Java for Programmers


1
CSC 224 Java for Programmers
  • Summer 2001 (2001/07/23 -- 2001/08/22)
    Monday/Wednesday 600 -- 915 pm
  • Loop campus CST 218 Instructor Dr. Xiaoping
    Jia Office Room 843, CST Building Tel (312)
    362-6251, Fax (312)362-6116 Office hours
    Monday and Wednesday
  • 500 -- 600pm (Loop campus) E-mail
    jia_at_cs.depaul.edu Home page http//www.depaul.ed
    u/xjia

2
A Brief History
  • January 1996 first official release JDK 1.0
  • Web applets, security, URL, networking
  • GUI Abstract Windows Toolkit (AWT)
  • February 1997 JDK 1.1
  • Authentication digital signatures, certificates
  • Distributed computing RMI, object
    serialization,  Java IDL/CORBA
  • Database connectivity JDBC
  • Component architecture JavaBean

3
A Brief History (contd)
  • December 1998 Java 2 Platform (JDK 1.2)
  • Standard (J2SE), Enterprise (J2EE), and Micro
    (J2ME) Editions
  • JFC Swing, Java2D, Java3D
  • Java Cryptography Extension (JCE)
  • Enterprise computing enterprise JavaBean (EJB), 
    servlets, Java server page (JSP), Jini, XML
  • Java Multimedia Framework  (JMF)
  • Embedded systems KVM, JavaCard
  • Performance enhancement JIT, HotSpot VM

4
A Brief History (contd)
  • May 2000 J2SDK v1.3
  • Enhancements in features, performance, and
    security.
  • May 2001 J2SDK v1.4 beta
  • XML, XSLT, JCE, etc. all included in J2SE
  • Numerous enahnacements I/O, assertions, regular
    expression, logging, etc.
  • 2002(?) J2SDK v1.5
  • Generic types

5
Characteristics of Java
  • Simple
  • Object-oriented
  • Statically typed
  • Compiled
  • Architecture neutral
  • Garbage collected
  • Multi-threaded
  • Robust
  • Secure
  • Extensible

6
Your First Java Program
/ Example HelloWorld Prints the message
"Hello, World! / public class HelloWorld
public static void main(String args)
System.out.println("Hello, world.)
7
Packages
  • Java provides mechanisms to organize large-scale
    programs in a logical and maintainable fashion.
  • Class --- highly cohesive functionalities
  • File --- one class or more closely related
    classes
  • Package --- a collection of related classes or
    packages

8
Java Class Library
  • The Java class library is organized into a number
    of packages
  • java.lang --- general
  • java.awt --- GUI
  • java.io --- I/O
  • java.util --- utilities
  • java.applet --- applet
  • java.net --- networking

9
Another Example
// Example Time // Prints a greeting message with
// the current time. import java.util.
public class Time public static void
main(String args) System.out.println("He
llo!) System.out.println("The time is "
new Date())
10
Java Reserved Wrods
abstract boolean break byte byvalue case cast catc
h char class const continue
default do double else extends false final finally
float for future generic
goto if implements import inner instanceof int int
erface long native new null
operator outer package private protected public re
st return short static super switch
synchronized this throw throws transient true try
var void volatile while
11
Data Types
12
Boolean Type
  • boolean
  • Boolean constants true false

13
Integer Types
  • int
  • byte
  • Short
  • long
  • Examples of integer constants
  • 354
  • -37
  • 0
  • 246543

14
Floating Point Type
  • Double
  • float
  • Examples of floating point constants
  • 4.642
  • -0.034
  • 5.98e24
  • 9.11e-31

15
Character Type
  • char
  • 16-bit Unicode character.
  • ASCII is a subset of Unicode --- ISO-8859
    (Latin-1)
  • Examples of character constants 'A' 'y' '8'
    '' ' ' (space) '\n' (new line).

16
Escape Sequences
 
\uhhhh hex-decimal code, e.g. \u000A \ddd octal
code, e.g. \040
17
String
  • Examples of string literals "watermelon" "fig"
    "!!" "354" " " (space) "" (empty
    string)
  • constructor
  • operator and
  • methods
  • charAt(int i)
  • length()

18
Arithmetic Operators and Expressions
  •   addition
  • -  subtraction
  •   multiplication
  • /  division
  •   remainder
  • precedence and association

19
Example Time2
import java.util. public class Time2
public static void main(String args)
Calendar calendar Calendar.getInstance()
int hour calendar.get(Calendar.HOUR_OF_DAY)
int minute calendar.get(Calendar.MINUTE)
int second calendar.get(Calendar.SECOND)
System.out.println("Hello!")
System.out.println("The time is "
hour / 10 hour 10 ""
minute / 10 minute 10 ""
second / 10 second 10)
20
Variable declaration and initialization
int x, y, z long count char a, b boolean
flag float massInKilos short timeInSeconds
245 char ch1 'K', ch2 '' boolean isNew
true double maxVal 35.875
21
Assignments
total quantity unitPrice count count 1
count 1 count
Write a Comment
User Comments (0)
About PowerShow.com