FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Java-Programs/constructor_overloading.java at main · VirajPatidar/Java-Programs · GitHub
VirajPatidar
/
Java-Programs
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
1
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Java-Programs
/
constructor_overloading.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
34 lines (31 loc) · 952 Bytes
Breadcrumbs
Java-Programs
/
constructor_overloading.java
Copy path
File metadata and controls
34 lines (31 loc) · 952 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
class
constructor_overloading
{
String
language
;
constructor_overloading
() {
this
.
language
=
"Java"
;
}
constructor_overloading
(
String
language
) {
this
.
language
=
language
;
}
public
void
getName
() {
System
.
out
.
println
(
"Programming Langauage: "
+
this
.
language
);
}
public
static
void
main
(
String
[]
args
) {
// non-parameterized constructor
constructor_overloading
obj1
=
new
constructor_overloading
();
// parameterized constructor
constructor_overloading
obj2
=
new
constructor_overloading
(
"C++"
);
obj1
.
getName
();
obj2
.
getName
();
}
}
// class Main {
// int a;
// boolean b;
// public static void main(String[] args) {
// // A default constructor is called
// Main obj = new Main();
// System.out.println("Default Value:");
// System.out.println("a = " + obj.a);
// System.out.println("b = " + obj.b);
// }
// }
Back
|
FazBrowse Home
|
New Git URL