We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 86b1cc9 commit 7a1ae00Copy full SHA for 7a1ae00
Lab Experiments/Experiment 4/Exp4_1.java
@@ -0,0 +1,24 @@
1
+// Exp-04 part 1 :Inheritance
2
+import java.io.*;
3
+
4
+//Super Class
5
+class Fruit {
6
+ private String season = new String("Summers"); //Private Access Modifier
7
+ int price = 80;
8
+ void getprice(){
9
+ System.out.println(price);
10
+ }
11
+}
12
+//Sub Class
13
+class Mango extends Fruit {
14
+ String name = new String("Mango");
15
16
17
+public class Exp4_1 extends Fruit {
18
+ public static void main (String[] args) {
19
+ Mango obj = new Mango();
20
+ obj.getprice();
21
+ // System.out.print(obj.season);
22
23
+ }//main
24
+}//test
0 commit comments