Skip to content

Commit 58b7d9f

Browse files
abstract classes
1 parent 930dd0a commit 58b7d9f

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
abstract class Class1 {
2+
abstract void method2();
3+
void method1(){
4+
System.out.println("Factorial of 5 is:");
5+
int f=1,i;
6+
for(i=1;i<=5;i++){
7+
f=f*i;
8+
}
9+
System.out.println(f);
10+
}
11+
}
12+
class Class2 extends Class1{
13+
void method2(){
14+
int a=11,b=234;
15+
System.out.println("Addtion of two number is : " + (a+b));
16+
}
17+
}
18+
19+
public class AbstrackMethod {
20+
public static void main(String args[]){
21+
Class2 obj =new Class2();
22+
obj.method1();
23+
obj.method2();
24+
}
25+
}

0 commit comments

Comments
 (0)