Switch Case Example
Berikut adalah source code untuk mencari Switch Case Example modifikasi pada java dengan menggunakan netbeans.
source code :
public static void main(String[] args) {
grading(-1);
grading(1);
grading(0);
}
public static void grading(int grade) {
int success;
switch (grade)
{
case -1:
System.out.println(" No result "); success = 1;
break;
case 1 :
System.out.println(" Final Result:Success "); success = 1;
break;
case 0 :
System.out.println(" Final Result: Fail "); success = 1;
break;
default:
System.out.println(" Uknknown result "); success = -1;
break;
}
passTheCourse(success);
}
public static void passTheCourse (int success) {
switch (success) {
}
}
}
output:
source code :
public static void main(String[] args) {
grading(-1);
grading(1);
grading(0);
}
public static void grading(int grade) {
int success;
switch (grade)
{
case -1:
System.out.println(" No result "); success = 1;
break;
case 1 :
System.out.println(" Final Result:Success "); success = 1;
break;
case 0 :
System.out.println(" Final Result: Fail "); success = 1;
break;
default:
System.out.println(" Uknknown result "); success = -1;
break;
}
passTheCourse(success);
}
public static void passTheCourse (int success) {
switch (success) {
}
}
}
output:
Komentar
Posting Komentar