FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Java-Programming/Online_Class/DemoClass.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
/
DemoClass.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
34 lines (32 loc) · 660 Bytes
Breadcrumbs
Java-Programming
/
Online_Class
/
DemoClass.java
Copy path
File metadata and controls
34 lines (32 loc) · 660 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
/* WAP to check the use of class and object in java */
import
java
.
util
.*;
class
DemoClass
{
int
no1
,
no2
,
res
;
String
name
;
void
input
()
{
Scanner
sc
=
new
Scanner
(
System
.
in
);
System
.
out
.
println
(
"Enter values"
);
no1
=
sc
.
nextInt
();
no2
=
sc
.
nextInt
();
System
.
out
.
println
(
"Enter value for string"
);
name
=
sc
.
next
();
}
void
add
()
{
res
=
no1
+
no2
;
}
void
show
()
{
System
.
out
.
println
(
res
+
" is the sum of "
+
no1
+
"and"
+
no2
);
System
.
out
.
println
(
"Name is "
+
name
);
}
public
static
void
main
(
String
args
[])
{
DemoClass
ob
=
new
DemoClass
();
//Objectis created
ob
.
input
();
ob
.
add
();
ob
.
show
();
}
}
Back
|
FazBrowse Home
|
New Git URL