JBKCORE9004 Class Method Calling
JBKCORE9004 Class Method Calling
:8888809416
1|Page www.jbktest.com
www.thekiranacademy.com JBKCORE9004-class-method-calling Mob No.:8888809416
class mainExercise1 {
class AA {
void display1() {
System.out.println("This is Class - 1");
}
}
class BB {
void display2() {
System.out.println("This is Class - 2");
}
}
class CC {
2|Page www.jbktest.com
www.thekiranacademy.com JBKCORE9004-class-method-calling Mob No.:8888809416
void display3() {
System.out.println("This is Class - 3");
}
}
class mainExercise2 {
3|Page www.jbktest.com
www.thekiranacademy.com JBKCORE9004-class-method-calling Mob No.:8888809416
void add() {
int c = a + b;
System.out.println("The int Value is : " + c);
}
void check() {
if (a == true) {
a = false;
System.out.println("The Boolean Value is : " + a);
}
}
4|Page www.jbktest.com
www.thekiranacademy.com JBKCORE9004-class-method-calling Mob No.:8888809416
System.out.println(obj.a);
}
void join() {
System.out.println("The Characters Value is : " + a + b + c + d);
}
5|Page www.jbktest.com
www.thekiranacademy.com JBKCORE9004-class-method-calling Mob No.:8888809416
public class
Method_Ex1 {
int x = 10, y =
20; float z;
void add() {
z=x
+ y;
displa
y(z);
}
void sub() {
z=x
- y;
displa
y(z);
}
void mult() {
z=x
* y;
displa
y(z);
}
void div() {
z=x
/ y;
displa
y(z);
6|Page } www.jbktest.com
7|Page www.jbktest.com
www.thekiranacademy.com JBKCORE9004-class-method-calling Mob No.:8888809416
8|Page www.jbktest.com
www.thekiranacademy.com JBKCORE9004-class-method-calling Mob No.:8888809416
Homework
1. Data should be sent through main method or while calling
methods
1. Write a program to calculate cube input will be sent through method
arguments
2. Write a program to calculate simple interest
3. Write a program to calculate compound interest
4. The marks obtained by a student in 5 different subjects are input
through the method call. The student gets a division as per the
following rules:
a. Percentage above or equal to 60 - First division
b. Percentage between 50 and 59 - Second division
c. Percentage between 40 and 49 - Third division
d. Percentage less than 40 - Fail
e. Write a program to calculate the division obtained by the
student.
https://drive.google.com/drive/folders/1xTkRzHymIbLXvSNfAfA8JdxAiqOLIP
mR?usp=sharing
9|Page www.jbktest.com