由买买提看人间百态

topics

全部话题 - 话题: egg2
(共0页)
Z*****Z
发帖数: 723
1
来自主题: JobHunting版 - 发一个有趣的java题
Egg2 e2 = new BigEgg2();
BigEgg2 Constructor called
Egg2 constructor called
Yolk y initialize
Egg2.Yolk constructor called
"Egg2.Yolk()"
Egg2.Yolk constructor return
"New Egg2()"
Egg2 constructor return
now back in BigEgg2 constructor
create a new BigEgg2.Yolk object
BigEgg2.Yolk constructor called
Egg2.Yolk constructor called
"Egg2.Yolk()"
Egg2.Yolk constructor return
"BigEgg2.Yolk... 阅读全帖
t**********h
发帖数: 2273
2
来自主题: JobHunting版 - 发一个有趣的java题
今天面了一个和下面类似的一个题,很有意思,大家一起看看。写出打印的东西
class Egg2 {
protected class Yolk {
public Yolk() { print("Egg2.Yolk()"); }
public void f() { print("Egg2.Yolk.f()");}
}
private Yolk y = new Yolk();
public Egg2() { print("New Egg2()"); }
public void insertYolk(Yolk yy) { y = yy; }
public void g() { y.f(); }
}
public class BigEgg2 extends Egg2 {
public class Yolk extends Egg2.Yolk {
public Yolk() { print("BigEgg2.Yolk()"); }
public void f() { print("BigEgg2.Yolk.f()"); }
}
p... 阅读全帖
z*********e
发帖数: 10149
3
来自主题: DataSciences版 - 一道老智商题
最差情况下careercup里面的解是
Goal: Create a system for dropping Egg1 so that the most drops required is
consistent, whether Egg1 breaks on the first drop or the last drop 1 A
perfectly load balanced system would be one in which Drops of Egg1 + Drops
of Egg2 is always the same, regardless of where Egg1 broke 2 For that to be
the case, since each drop of Egg1 takes one more step, Egg2 is allowed one
fewer step 3 We must, therefore, reduce the number of steps potentially
required by Egg2 by one drop each... 阅读全帖
r****y
发帖数: 26819
(共0页)