Umesh Patidar PPT On Java Final
Umesh Patidar PPT On Java Final
Sagar, Madhya-Pradesh
College
Internship Presentation on
• Example programs
WHY JAVA?
switch (n + 1) {
case 0: m = n - 1; break;
case 1: m = n + 1;
case 3: m = m * n; break;
default: m = -n; break;
}
• Java also introduces the try statement, about which more later
JAVA ISN'T C!
import java.awt.*;
import java.util.*;
public class SomethingOrOther {
// object definitions go here
...
}
• A class consists of
• a collection of fields, or variables, very much like the named fields of
a struct
• all the operations (called methods) that can be performed on those
fields
• can be instantiated
class Person {
String name;
int age;
void birthday ( ) {
age++;
System.out.println (name + ' is now ' + age);
}
}
ANOTHER EXAMPLE OF A CLASS