-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsta_tic.java
More file actions
76 lines (60 loc) · 1.41 KB
/
Copy pathsta_tic.java
File metadata and controls
76 lines (60 loc) · 1.41 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
73
74
75
76
class mobile
{
String brand;
int price;
static String name = "smartphone";
static
{
name = "android";
System.out.println("android mobile");
}
public mobile()
{
brand = "defualt";
price = 200;
name = "phone";
}
public void details()
{
System.out.println(brand + " : " + price + " : " + name);
}
public static void report()
{
System.out.println(name);
}
public static void report_new(mobile mob)
{
System.out.println(mob.brand + " : " + mob.price + " : " + name);
}
}
public class sta_tic {
public static void main(String[] args)
{
mobile m1 = new mobile();
m1.brand = "samsung";
m1.price = 1000;
mobile m2 = new mobile();
m2.brand = "apple";
m2.price = 5000;
m1.details();
m2.details();
mobile m3 = new mobile();
m3.brand = "moto";
m3.price = 500;
mobile.name = "dial phone";
m3.details();
m2.details();
m1.details();
mobile.report();
System.out.println();
mobile.report_new(m1);
mobile mo1 = new mobile();
System.out.println(mo1.brand);
System.out.println(mo1.price);
mo1.brand = "redmi";
mo1.price = 700;
mo1.details();
mobile.report_new(mo1);
mobile.report();
}
}