-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAssignment41_this.java
More file actions
38 lines (29 loc) · 861 Bytes
/
Assignment41_this.java
File metadata and controls
38 lines (29 loc) · 861 Bytes
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
37
38
package abhilash_Asignments;
public class Assignment41_this // class
{
// without parameter also we can create a constructor
Assignment41_this(int a) // constructor
{
System.out.println("This is First Constructor");
}
Assignment41_this(int a, int b) // constructor
{
this(01);
System.out.println("This is second constructor");
}
Assignment41_this(int a, double b) // constructor
{
this(6, 7);
System.out.println("This is Third constructor");
}
Assignment41_this(double a) // constructor
{
this(10, 20.2); // ----------------------------------------this calling statement it can be
// first line of every cnstructor
System.out.println("This is Fourth constructor");
}
public static void main(String[] args) // main method
{
Assignment41_this a2 = new Assignment41_this(2.55); // creating an object to the class
}
}