Overview%20of%20Java - PowerPoint PPT Presentation

About This Presentation
Title:

Overview%20of%20Java

Description:

Overview of Java CS 3250 – PowerPoint PPT presentation

Number of Views:238
Avg rating:3.0/5.0
Slides: 42
Provided by: Xiaop150
Category:

less

Transcript and Presenter's Notes

Title: Overview%20of%20Java


1
Overview of Java
  • CS 3250

2
A Brief History
  • January 1996
  • first official release JDK 1.0
  • Web applets, security, URL, networking
  • GUI Abstract Windows Toolkit (AWT)

"To be blunt, Java 1.0 was not ready for prime
time." Core Java, Vol. I, p. 9
3
A Brief History(continued)
  • February 1997 JDK 1.1
  • Authentication digital signatures, certificates
  • Distributed computing RMI, object serialization,
    Java IDL/CORBA
  • Database connectivity JDBC
  • Component architecture JavaBean

Version 1.1 "filled in the most obvious gaps,
greatly improved the reflection capability, and
added a new event model for GUI programming. It
was still rather limited, though." Core Java,
Vol. I, p. 9
4
A Brief History(continued)
  • December 1998
  • Java 2 Platform (JDK 1.2)
  • Standard, Enterprise, and Micro Editions
  • JFC Swing, Java2D, Java3D
  • Java Cryptography Extension (JCE)
  • Enterprise computing enterprise JavaBean (EJB),
    servlets, Java server page (JSP), Jini, XML

5
A Brief History(continued)
  • More changes in 1.2 (Java 2)
  • Java Multimedia Framework (JMF)
  • Embedded systems KVM, JavaCard
  • Performance enhancement JIT, HotSpot VM

Version 1.2 "replaced the early toylike GUI and
graphics toolkits with sophisticated and scalable
versions that came a lot closer to the promise of
'Write Once, Run Anywhere' than their
predecessors." Core Java, Vol. I, p. 10
6
A Brief History(continued)
  • Versions 1.3 and 1.4
  • incremental improvements to library, performance
  • bug fixes

"During this time, much of the initial hype about
Java applets and client-side applications abated,
but Java became the platform of choice for
server-side applications." Core Java, Vol. I, p.
10
7
A Brief History(continued)
  • Versions 5.0 (originally 1.5)
  • significant changes to language, not just library
  • generic classes
  • features inspired by C
  • "for each" loop, autoboxing, metadata

"Language changes are always a source of
compatibility pain, but several of these new
language features are so seductive that we think
programmers will embrace them eagerly." Core
Java, Vol. I, p. 10
8
Evolution of Java
Version New Language Features Classes and Interfaces
1.0 The language itself 211
1.1 Inner classes 477
1.2 None 1524
1.3 None 1840
1.4 Assertions 2723
5.0 Generic classes, "for each" loop, varargs, autoboxing, metadata, enumerations, static import 3270
based on p. 10 of Core Java, Vol. I
9
Top 10 Reasonsfor Using Java
  • Or, 10 ways to start an argument

10
10. Garbage Collected
  • C and C are not, but most other modern
    languages are

11
9. Visual Studio
  • Platform-specific
  • Version problems
  • Impossible to write a small program
  • Lack of support for command-line tools
  • Emacs, make, javac, java

12
8. Multi-threaded
  • Runnable
  • synchronized

13
7. Distributed
  • Socket classes
  • Remote Method Invocation (RMI)
  • Serialization

14
6. GUI-less GUIs
  • Can make a GUI with just a text editor
  • Also, flexible GUIs (layouts)

15
5. Jobs
  • Personally, I havent heard of a good way to
    measure this

16
4. Pervasive
  • http//code.google.com/android
  • The Open Handset Alliance, a group of more than
    30 technology and mobile companies, is developing
    Android the first complete, open, and free
    mobile platform.
  • Also servlets, applets, JSP, current phone
    platforms

17
3. Linux, OS X
  • Architecture neutral

18
2. Libraries
  • Thousands of classes
  • Comprehensive and useful documentation

19
And the number one reason is. . .
20
1. Portable, standard, and free Graphics and GUIs
  • Near misses
  • wxWidgets (not standard, not particularly easy to
    use)
  • QT (not free or standard)
  • GTK (not standard)
  • .NET (not portable)

21
Top 10 reasons NOT to use Java
  • You cant say Im biased

22
10. Unity
  • Unity? Huh?
  • JavaScript, C, Boo

23
9. ReallyLongVariableNamesAndClassNamesForWhichJav
aIsFamousOrInfamous
24
8. Java is hard to teach
  • Too many things that cant be explained at the
    beginning
  • Do you believe it?

25
7. J2EE
  • But, some people think this is Javas niche

26
6. Java is the new COBOL
  • Do you believe it?

27
5. Bad press
  • Overhyped, misconceptions
  • See Professor Allisons D paper

28
4. Suns follies
  • ME (and not working with Palm)
  • Java Media Framework
  • Java 3D
  • Quicktime for Java (OK, thats Apples)

Is Oracle doing any better?
29
3. C and the 900-pound gorilla
30
2. Python, JavaScript
  • But, see Jython and Rhino
  • Maybe Ruby, D, and maybe even PHP (but not Perl)

31
1. Performance
  • Not as fast as C or C
  • Is it fast enough?

32
Whats Missing(vs. C)
  • Explicit pointers
  • Delete operator
  • Destructors
  • References (pass-by-reference)
  • Default arguments

33
Whats Missing(vs. C)
  • Globals
  • Local static data
  • Operator overloading
  • Multiple (implementation) inheritance
  • Separation of declaration and definition
  • Templates (generics added in 1.5)

34
Whats New
  • Everything resides in a class
  • Data and functions
  • Garbage collection
  • Fewer memory management headaches
  • Exceptions not optional
  • Unicode encoding
  • Portable
  • Threads
  • Networking
  • Data sizes

35
Java Architecture
  • Java code is compiled into platform-independent
    byte code (javac.exe)
  • Each class in its own .class file
  • The Java Virtual Machine runs in the target
    environment (java.exe)
  • Interprets the byte code
  • Advantage portability (write-once-run-anywhere)
  • Disadvantage degraded performance

36
JIT Compilation
  • Just-in-time compilation
  • The JVM has the JIT compiler compile the code
    into native machine code
  • 10-20 times faster than classic JVM interpretation

37
First Java Application
  • Every program must have at least one class
  • Source file must be class name plus ".java"

public class Hello public static void main
(String args) System.out.println("Hel
lo, world")
38
First Java Application
  • The famous "magic formula" for the main method of
    a Java application

public class Hello public static void main
(String args) System.out.println("Hel
lo, world")
39
Elements of Java Programs
  • Class Hello
  • Method main(...)
  • Statement System.out.println(...)
  • Comments
  • // a comment
  • / another comment /
  • / document comment /
  • Source file Hello.java (case sensitive)

40
Development Environments
  • Java SDK from Oracle
  • www.oracle.com/technetwork/java/javase/downloads/i
    ndex.html
  • command-line tools javac, java, etc.
  • no editor included
  • netBeans (netbeans.org)
  • IDE, including Java beans (components)
  • Eclipse IDE (eclipse.org)
  • IDE
  • All of these are free
  • See Ch. 2 and the web sites for more information.

41
Compile and Run an Appusing the Java SDK
command-line tools
  • To compile
  • javac Hello.java
  • To run
  • java Hello
Write a Comment
User Comments (0)
About PowerShow.com