File tree 1 file changed +55
-0
lines changed
1 file changed +55
-0
lines changed Original file line number Diff line number Diff line change
1
+ class vehicle
2
+ {
3
+ int speed=126;
4
+ String na="baleno";
5
+
6
+ public vehicle(int sp){
7
+ this.speed=sp;
8
+ }
9
+
10
+ public vehicle(int a,String s)
11
+ {
12
+ this.speed=a;
13
+ this.na=s;
14
+ }
15
+
16
+
17
+ public int getspeed()
18
+ {
19
+ return speed;
20
+ }
21
+
22
+ public String getstring()
23
+ {
24
+ return na;
25
+ }
26
+ }
27
+
28
+ class car extends vehicle
29
+ {
30
+
31
+ String bike;
32
+ public car(int sp,String d)
33
+ {
34
+ super(sp);
35
+ this.bike=d;
36
+ System.out.println("the source code is avalaible at github");
37
+ }
38
+
39
+ public String getbike()
40
+ {
41
+ return bike;
42
+ }
43
+ }
44
+
45
+ public class superv {
46
+
47
+ public static void main(String[] args)
48
+ {
49
+ car obj2=new car(169,"ktm duke");
50
+ System.out.println("the car speed is "+obj2.getspeed()+" and the car name is "+obj2.getstring()+
51
+ " and bike name is "+obj2.getbike());
52
+ }
53
+
54
+
55
+ }
You can’t perform that action at this time.
0 commit comments