-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDoll.java
More file actions
54 lines (45 loc) · 1.31 KB
/
Doll.java
File metadata and controls
54 lines (45 loc) · 1.31 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
public class Doll{
private static int number=0;
private int id=0;
private String name=null;
public Doll(String name){
this.name=name;
number++;
id=number;
}
public void speak(String word){
String showNumber="目前共有"+number+"娃娃!";
String showId="我的ID是"+id;
System.out.println(name+":"+showNumber);
System.out.println(name+":"+showId);
System.out.println(name+":"+word);
}
public static void main(String[] args){
Doll doll1=new Doll("贝贝");
Doll doll2=new Doll("晶晶");
doll1.speak("大家好!");
doll2.speak("大家好!");
int month=1;
month=month+10;
month=(byte) (month+1);
System.out.println(month);
float s1=0;
for (int i=0; i<26; i++)
s1+=0.1F;
System.out.println(s1);
double s2=0;
for (int i=0;i<26;i++)
s2+=0.1;
System.out.println(s2);
double f1=0.0/0.0;
double f2=1.0/0.0;
//int f3=(int) (-1/0);
//long f4= (1/0);
float f5=(float) (1.0/0.0);
System.out.println(f1);
System.out.println(f2);
//System.out.println(f3);
//System.out.println(f4);
System.out.println(f5);
}
}