FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Java-Programming/Online_Class/InheritanceDemo.java at master · SHembram18/Java-Programming · GitHub
SHembram18
Java-Programming
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Java-Programming
/
Online_Class
/
InheritanceDemo.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
36 lines (36 loc) · 591 Bytes
Breadcrumbs
Java-Programming
/
Online_Class
/
InheritanceDemo.java
Copy path
File metadata and controls
36 lines (36 loc) · 591 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* WAP to implement single inheritance */
import
java
.
util
.*;
class
Base
{
int
no1
;
void
show
()
{
System
.
out
.
println
(
"Base Class"
);
}
}
class
Derived
extends
Base
{
int
no2
;
void
input
()
{
Scanner
sc
=
new
Scanner
(
System
.
in
);
System
.
out
.
println
(
"Enter values"
);
no1
=
sc
.
nextInt
();
no2
=
sc
.
nextInt
();
}
void
show1
()
{
System
.
out
.
println
(
"Derived Class"
);
System
.
out
.
println
(
"Values are no1 = "
+
no1
+
" and no2 = "
+
no2
);
}
}
class
InheritanceDemo
{
public
static
void
main
(
String
args
[])
{
Derived
ob
=
new
Derived
();
ob
.
input
();
ob
.
show
();
ob
.
show1
();
}
}
Back
|
FazBrowse Home
|
New Git URL