Object Oriented Programming: Department of Computing and Information Systems
Object Oriented Programming: Department of Computing and Information Systems
Because the Java VM is available on many different operating systems, the same .class files
are capable of running on Microsoft Windows, the Solaris TM Operating System (Solaris OS),
Linux, or Mac OS. Department of Computing and Information
Systems
class Myprogram{
public static void main(String[] args){
System.out.println(" Object oriented programming with
Java");
}
} String[] args or String args[].
………..
statement n;}
• For compound statements of nested if also
used Department of Computing and Information
Systems
What will be the output
class IfElseDemo {
public static void main(String[] args) {
int testscore = 76;
char grade;
if (testscore >= 90) {
grade = 'A'; }
else if (testscore >= 80) {
grade = 'B'; }
else if (testscore >= 70) {
grade = 'C'; }
else if (testscore >= 60) {
grade = 'D'; }
else { grade = 'F'; }
System.out.println("Grade = " + grade); } }
Department of Computing and Information
Systems
The switch Statement
Syntax:
continue;