Skip to content

Commit 958f024

Browse files
committed
Add java OOP files
1 parent 5aaca5c commit 958f024

File tree

8 files changed

+339
-0
lines changed

8 files changed

+339
-0
lines changed

Abstraction/.idea/misc.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Abstraction/.idea/modules.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Abstraction/.idea/workspace.xml

Lines changed: 291 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Abstraction/Abstraction.iml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<module type="JAVA_MODULE" version="4">
3+
<component name="NewModuleRootManager" inherit-compiler-output="true">
4+
<exclude-output />
5+
<content url="file://$MODULE_DIR$">
6+
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
7+
</content>
8+
<orderEntry type="inheritedJdk" />
9+
<orderEntry type="sourceFolder" forTests="false" />
10+
</component>
11+
</module>
490 Bytes
Binary file not shown.
453 Bytes
Binary file not shown.
468 Bytes
Binary file not shown.

Abstraction/src/Test.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
abstract class Animal{
2+
private int age;
3+
abstract void eat();
4+
5+
void sleep(){
6+
System.out.println("Animal is sleeping...");
7+
}
8+
9+
}
10+
11+
class Dog extends Animal{
12+
void eat(){
13+
System.out.println("Dog is eating...");
14+
}
15+
}
16+
17+
class Test {
18+
public static void main(String args[]){
19+
Animal a = new Dog();
20+
a.eat(); // Executed with overriding
21+
a.sleep(); // Executed without overriding
22+
}
23+
}

0 commit comments

Comments
 (0)