Introduction To Sun Microsystems Java: High Level OOPL Platform Independent Case Sensitive
Introduction To Sun Microsystems Java: High Level OOPL Platform Independent Case Sensitive
java
-T.Balaji ,
B.E.,M.S.,
Java Applet
Java Applet
Server
Client
Server
Client
Server
EJB
JDBC
Compared to C++:
Java Features
Interfaces
Packages
Exceptions
Multi-Threading
Applet model
9
Java
Compiler
pretty portable
Java
Bytecode
10
JVM
12
JVM
13
Compile HelloWorld.java
javac HelloWorld.java
Output: HelloWorld.class
Run
java HelloWorld
14
15
Arithmetic: +, -, *,/, %, =
8 + 3 * 2 /4
Use standard precedence and associativity rules
16
}
public class Demo {
public static void main (String argv[]) {
int script = 6, acting = 9, directing = 8;
displayRating(script, acting, directing);
}
public static void displayRating(int s, int a, int d){
System.out.print(The rating of this movie is);
System.out.println(Movie.movieRating(s, a, d));
17
Inherits
Inherits
Inherits
Inherits
C can:
instance variables
static variables
instance methods
static methods
18
19
int minutes;
Attraction() {minutes = 75;}
int getMinutes() {return minutes;}
void setMinutes(int d) {minutes = d;}
abstract void m();
Following is an error:
Attraction x;
x = new Attraction();
20
Packages
Object
extends
Attraction
Auxiliaries
Demonstration
extends
Movie
Symphony
21