Java Reference
In-Depth Information
private int a;
private int b;
private int y;
Create variable;
a = 5;
b = 6;
c = 34;
y = Pass_chocolate (a. b)
If c >= 30 {
system.out.println(y)
}.
Else {
system.out.println( “age of the leader is below 30 and so computation not
possible”)
}
}
}
What we have created here is a class named “my_class” with 2 methods. Now if we
want to access any of the methods then we can use my_class.Pass_chocolates(a, b) or
my_class.Chocolate_computation() provided the 2 methods are declared public.
Let us understand some more concepts about classes in object oriented programming.
Search WWH ::




Custom Search