-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathThisEx.java
More file actions
72 lines (52 loc) · 1.29 KB
/
Copy pathThisEx.java
File metadata and controls
72 lines (52 loc) · 1.29 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.mycompany.firstjavaprg;
import java.util.Scanner;
/**
*
* @author my
*/
class CarEx
{
CarEx(int id, String name, String address){
this(id, name);
System.out.println(address);
}
CarEx(int id, String name)
{
this();
System.out.println(id);
System.out.println(name);
}
CarEx( )
{
System.out.println("hello");
}
void m(CarEx obj)
{
System.out.println(obj.add());
}
void n(){
m(this);
}
int add(){
return 10;
}
}
public class ThisEx {
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
System.out.println("Enter a id");
int i = sc.nextInt();
System.out.println("Enter a name");
String n = sc.next();
System.out.println("Enter a id");
String add = sc.next();
CarEx ex = new CarEx(i,n,add);
ex.n();
}
}