Title: Overview%20of%20Java
1Overview of Java
2A 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
3A 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
4A 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
5A 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
6A 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
7A 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
8Evolution 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
9Top 10 Reasonsfor Using Java
- Or, 10 ways to start an argument
1010. Garbage Collected
- C and C are not, but most other modern
languages are
119. Visual Studio
- Platform-specific
- Version problems
- Impossible to write a small program
- Lack of support for command-line tools
- Emacs, make, javac, java
128. Multi-threaded
137. Distributed
- Socket classes
- Remote Method Invocation (RMI)
- Serialization
146. GUI-less GUIs
- Can make a GUI with just a text editor
- Also, flexible GUIs (layouts)
155. Jobs
- Personally, I havent heard of a good way to
measure this
164. 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
173. Linux, OS X
182. Libraries
- Thousands of classes
- Comprehensive and useful documentation
19And the number one reason is. . .
201. 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)
21Top 10 reasons NOT to use Java
2210. Unity
- Unity? Huh?
- JavaScript, C, Boo
239. ReallyLongVariableNamesAndClassNamesForWhichJav
aIsFamousOrInfamous
248. Java is hard to teach
- Too many things that cant be explained at the
beginning - Do you believe it?
257. J2EE
- But, some people think this is Javas niche
266. Java is the new COBOL
275. Bad press
- Overhyped, misconceptions
- See Professor Allisons D paper
284. Suns follies
- ME (and not working with Palm)
- Java Media Framework
- Java 3D
- Quicktime for Java (OK, thats Apples)
Is Oracle doing any better?
293. C and the 900-pound gorilla
302. Python, JavaScript
- But, see Jython and Rhino
- Maybe Ruby, D, and maybe even PHP (but not Perl)
311. Performance
- Not as fast as C or C
- Is it fast enough?
32Whats Missing(vs. C)
- Explicit pointers
- Delete operator
- Destructors
- References (pass-by-reference)
- Default arguments
33Whats Missing(vs. C)
- Globals
- Local static data
- Operator overloading
- Multiple (implementation) inheritance
- Separation of declaration and definition
- Templates (generics added in 1.5)
34Whats 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
35Java 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
36JIT 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
37First 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")
38First 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")
39Elements of Java Programs
- Class Hello
- Method main(...)
- Statement System.out.println(...)
- Comments
- // a comment
- / another comment /
- / document comment /
- Source file Hello.java (case sensitive)
40Development 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.
41Compile and Run an Appusing the Java SDK
command-line tools
- To compile
- javac Hello.java
- To run
- java Hello