-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInterview.java
More file actions
44 lines (40 loc) · 1.01 KB
/
Interview.java
File metadata and controls
44 lines (40 loc) · 1.01 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
package importNew.interview;
import java.math.BigDecimal;
import java.util.PriorityQueue;
import java.util.Queue;
/**
* 面试题
*
* @author ken 2017-5-12 下午01:35:39
*/
class B extends Interview {}
class C extends B {}
public class Interview {
/**
* question 1:父类能转换成子类吗?
*
* 2017-5-12 下午01:48:57
*/
public static void translate() {
Interview in = new B();
System.out.println(in);
// 父类无法转换为子类
// C c=(C) new B();
// System.out.println(c);
}
/**
* question 2:3*0.1 == 0.3结果? 建议使用BigDecimal
*
* 2017-5-12 下午01:50:54
*/
public static void test() {
System.out.println("3*0.1:" + 3 * 0.1);
System.out.println("3*0.1==0.3:" + (3 * 0.1 == 0.3));
System.out.println(new BigDecimal(123456789.02).toString());
System.out.println(new BigDecimal("123456789.02").toString());
}
public static void main(String[] args) {
test();
Queue<Integer> q = new PriorityQueue<Integer>();
}
}