Java????????10??????
???????????? ???????[ 2014/12/4 11:14:40 ] ????????Java ??????? ????
????6. ???????
?????????????????????????????????????????????????????????????γ??????
????for (int i = 0; i < 10; i++) {
????System.out.println((Integer) i);
????}
????“???”?????????????????
????92
????221
????45
????48
????236
????183
????39
????193
????33
????84
????????????????
????. . . . . . . . .
?????????????????????
????. . . . . . . .
?????e??????????????????????д??JDK??Integer???????棬???????????????????????????????????????仰??????????????Σ?
???????????£???????δ????????????????????????????????
????image
????7. GOTO
??????????????????Java??????GOTO!???′?????
????int goto = 1;
?????????????
????Test.java:44: error: <identifier> expected
????int goto = 1;
???????????goto???????????????????????????????
??????????????????????????????????break??continue?????????????goto??????
???????????棺
????label: {
????// do stuff
????if (check) break label;
????// do more stuff
????}
????????????????
????2 iload_1 [check]
????3 ifeq 6 // Jumping forward
????6 ..
????????????棺
????label: do {
????// do stuff
????if (check) continue label;
????// do more stuff
????break label;
????} while(true);
????????????????
????2 iload_1 [check]
????3 ifeq 9
????6 goto 2 // Jumping backward
????9 ..
????8.Java??????????
???????????????У??????Ceylon????????????????????
????interface People => Set<Person>;
???????????????????People????????Set????????
????People? p1 = null;
????Set<Person>? p2 = p1;
????People? p3 = p2;
????Java????????????????????????????????????????????????????????????????????????????Integer?? Long???????????????????????Щ??I???L????????
????class Test<I extends Integer> {
????<L extends Long> void x(I i?? L l) {
????System.out.println(
????i.intValue() + "?? " +
????l.longValue()
????);
????}
????}
??????????γ????У???Test????????????Integer???????I??????x???????Long????L?????????????????????????????
????new Test().x(1?? 2L);
?????????????????????????????????У?Integer??Long????final?????????????I??L??????????????????????ɡ???????????????????assignment-compatibility??????????????????????final????????????Object?????????????????????????
??????????С?????????ɡ???????????????????????
????9. ?Щ????????????????
?????e??????е???????????????????????ɡ????????????????????
????// A helper type. You could also just use List
????interface Type<T> {}
????class C implements Type<Type<? super C>> {}
????class D<P> implements Type<Type<? super D<D<P>>>> {}
?????????C?????D?????????????
?????????????е????????java.lang.Enum???????????????饗???????в????????????????壺
????public abstract class Enum<E extends Enum<E>> { ... }
?????????????????淶???????????????????????????????????????
????// This
????enum MyEnum {}
????// Is really just sugar for this
????class MyEnum extends Enum<MyEnum> { ... }
?????????????????????????????????????????δ??????????????
????class Test {
????Type<? super C> c = new C();
????Type<? super D<Byte>> d = new D<Byte>();
????}
????????????е????????Ross Tate?????????????????????????????
????C??Type<? super C>????????
????Step 0) C Step 1) Type>
????????
????D??Type<? super D>??????????
????Step 0) D > Step 1) Type>>> > Step 2) D >> Step 3) List>> > Step 4) D> >> Step . . . (expand forever)
?????????????Eclispe???????£?????????????????????????BUG??????????
????????????????????
????Java?е??Щ????????????
??????????Java???????????????????????????????Ross Tate?????????“??μ??Java???????е?????”????Alan Leung??Sorin Lerner????????????????????????????“????????????????????????”??
????10. ???????
????Java??????????????????????????????????????е????????????????????????????????????????????????????:
????class Test<T extends Serializable & Cloneable> {
????}
????????Test???е???????????T?????????Serializable??????Cloneable??????????String????????????????????Date???
????// Doesn't compile
????Test<String> s = null;
????// Compiles
????Test<Date> d = null;
????Java 8???????????????????????????????????????????????????????????????????????????????????lambda??????????????????????????????????????????????????????????????????????????????
????<T extends Runnable & Serializable> void execute(T t) {}
?????????Runnable?????????????Serializable??????????????????????????????????????Lambda?????????л?????????е???顣
????Lambda??????????????????л????
???????Lambda?????????????????????????л????????????????л????
???????????????????????????????????Serializable??????????????????????????????y?????????????????????????Serializable??????
????execute((Serializable) (() -> {}));
??????????Lambda???????????Runnable???????
?????????
?????????????????????
????execute((Runnable & Serializable) (() -> {}));
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11