A Little Cup of Java-Coffee: CS404: CAI Class Presentation - 01 By: Leo Sep, 2002
A Little Cup of Java-Coffee: CS404: CAI Class Presentation - 01 By: Leo Sep, 2002
CS404: CAI
Class Presentation_01
By: Leo
Sep, 2002
Todays session
Part-1) Java overview (5mins)
What java is
Java features
Javas cross-platform
Part-one
Java overview
What Java is
Java is an easy programming language,
just a tool like C++, VB, and English. Somehow a
language tool itself is not so complex.
Javas Features
Simple
Java omits many rarely used, poorly understood, confusing
features of C++. Say : No Pointer! No dynamic delete.
Object Oriented
Object oriented design is a technology that focuses design
on the data (object) and on the interfaces to it.
Lets say, everything is an object, everything will
become a class in Java. Every java program, in toplevel view, is classes.
Javas Features(continue)
Distributed
Basically, Java is for Net-Work application, for WEB
project.
Java can open and access objects across the Net via
URLs (Uniform Resource Locator)----eg.
http//:gamut.neiu.edu/~ylei/home.html,
with the same ease as when accessing a local file system
Javas Features(continue)
Robust
The single biggest difference between Java
and C/C++ is that Java has a inner safe
pointer-model, therefore it eliminates the
possibility of overwriting memory and corrupting
data, so programmers feel very safe in coding.
Javas Features(continue)
GUI
[Java-Swing]
Multi-threaded
Secure
[ Exception handling ]
Dynamic
[ for Server-side coding]
Javas cross-platform
Interpreted Execute: cross-platform
why: For cross-platform purpose. Once coding, run anywhere.
---
obj
Demoh.h
2. Interpreters execute the source code directly. Examples:
BASIC, Perl, TCL/Tk, ML.
source
[load]
demo.perl -
data
[interpret run]
source-program
- Intel cpu
javac
byte-code files
bytecode program
|--
CPU
Part-2 2 samples
How many kinds of java programs ?
Demo-1: Stand-lone sample
Demo-2: an Applet sample
3
4
8
9
}
}
Java program
3
4
8
9
}
}
Java program
Packages
Set of predefined classes for us to use
Groups of related classes called packages
Group of all packages known as Java class library or Java
applications programming interface (Java API)
import javax.swing.JOptionPane;
4
5
JOptionPane.showMessageDialog(
null, "Welcome\nto\nJava\nProgramming!" );
10
11
12
13 }
System.exit( 0 );
}
Packages
Like namespace in C++
How to use:
C++: using namespace xxx
Java: import xxx, or
import xxx.xx
1
2
3
4
<html>
<applet code="WelcomeApplet.class" width=300 height=30>
</applet>
</html>
import javax.swing.JApplet;
import java.awt.Graphics;
5
6
10
11 }
<html>
</applet>
</html>
import javax.swing.JApplet;
import java.awt.Graphics;
5
6
10
11
12 }
1
2
3
4
<html>
<applet code="WelcomeApplet2.class" width=300 height=45>
</applet>
</html>
import javax.swing.JApplet;
import java.awt.Graphics;
4
5
10
11
12 }
<html>
<applet code="WelcomeLines.class" width=300 height=40>
</applet>
</html>
Part-3
How to learn Java by ourself
3 stages
S-1: basic
Contents: language grammars +
GUI (swings and event-driven)
Applets
2-4 weeks
Exception Handling
Threads
Streams
Network
4-8 weeks
3 Stages(contd)
S-3: Advanced projects
contents: JavaBeans
RMI
Servlets and JSP
EJB
many topics
time: years , just do projects with Java
Self-training Resources:
in Stage-1 and Stage-2
Suns free JSDK. Download and install it.
By the way, many books give us a free CD of JSDK.
Visit http://orion.neiu.edu/~ncaftori/
Jbuilder
Visual Age
Sun Forte
Visual Caf
J++