-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMobile.java
More file actions
49 lines (37 loc) · 1.02 KB
/
Mobile.java
File metadata and controls
49 lines (37 loc) · 1.02 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
package MethodsComputer;
class Mobile{
String brand;
int price;
String network;
// String name;
static String name;
public void show() {
System.out.println(brand+" : "+price+" : "+name);
}
public static void show1(Mobile obj)
{
// System.out.println("in static method");
System.out.println(obj.brand+" : "+ obj.price +" : "+obj.name);
}
public static class Demo01 {
public static void main(String[] args)
{
Mobile obj1=new Mobile();
obj1.brand="Apple";
obj1.price=1500;
//obj1.name="SmartPhone";
name ="SmartPhone";
Mobile obj2=new Mobile();
obj2.brand="Samsung";
obj2.price=1700;
//obj2.name="SmartPhone";
name ="SmartPhone";
//obj1.name="Phone";
name ="SmartPhone";
obj1.show();
obj2.show();
show1(obj1);
//System.out.println(obj1.brand);
}
}
}