Java ?? ???? ????? i++? ?? ??? ??? ?????.
????? ???, ?? ?? ?? ??? ??? ????? ??? ?? ? ??? ?? ??? ?????? ???. ?? ??? ?? ?? ??? ?? ??? ?? ???? ???.
??
????? ? ???? ?? ???? ??? ?????. ??? ?? ???? ??, ???? ???? ???? ????. (? ??? ???? ??? Kibana ??? ? ?? ?? ? ????.) ??? ? ??? ???? ?? ??? ???? ??????.
Analytics
?? ??? ??? ??? ?? ????? ??? ? ????.
- ?? ??? ???? ??? ??? 1?????.
- ??? ???? ?? ?? ???? ??? ???? ?? ??? ??? ?????.
- ?? ???? ?? ??? ??? ?? ??? ??? ??????.
Digression
? ?? ??? ?? MQ ??? ?? ?? ????? ???? ??? ??? ??????. ??? ?? ?? ???? ????? ??? ???. (MQ? ?? ?? ? ??? ?????)
Digression
??? ??? ??? ????.
- ?? ??? SQL? ?? ????? ???? ??? ?? ? ????. ???? 1? ?? ???? ? ?? One ??? ??? ? ????.
- ?? ???? ?? ??, ??? ??? ?? ?????. ?? ??? ??? ??? ???? ??????.
- ?? ???? ????? ???? ???? ??? ???? ??? ??? ????? ?? ????? ??? ??? ??? ?????.
? ??? ?? ???? ????? ??? ???? ?? ??? ??? ????? ?? ??? ?? ??? ???? ???? ???. (??? ??? ?? ??? ??? ?????? ???? ?? ?????. ?? ??? ????? ?????, ??? ??? ?? ????. ??? ???? ???? ?? ?? ??? ???? ? ?? ???? ?????. ??, ?? ??? ???? ?? ??? ? ?? ????.
????? for ?? ?? ?????.
Code
? ?? ???? ?? ??? ?? ???????. ?? ?? ?? ??? ?? ?? ??? ??? ???? ??????? ?? ?? ?? ??? ?? ?? ??????? ???. ??? ???? ??? ?? ???? ?? ????
import?com.google.common.collect.Lists;import?java.util.List;public?class?Test?{????public?static?void?main(String[]?args)?{????????//?獲取Customer數(shù)據(jù),這里就簡單模擬 ????????List<Customer>?customerList?=?Lists.newArrayList(new?Customer("Java"),?new?Customer("Showyool"),?new?Customer("Soga"));????????int?index?=?0; ????????String[][]?exportData?=?new?String[customerList.size()][2];????????for?(Customer?customer?:?customerList)?{ ????????????exportData[index][0]?=?String.valueOf(index); ????????????exportData[index][1]?=?customer.getName(); ????????????index?=?index++; ????????} ????????System.out.println(JSON.toJSONString(exportData)); ????} }class?Customer?{????public?Customer(String?name)?{????????this.name?=?name; ????}????private?String?name;????public?String?getName()?{????????return?name; ????}????public?void?setName(String?name)?{????????this.name?=?name; ????} }復制代碼
? ??? ???? ?? ??? ????. ?? Customer ???? 2?? ??? ??? ???? ?????. ??? ?? ??? ??? ????. ??? ??? ?? ?? ?????. ??? ?? ? ??? ??? ?????.
?? ?? ???? ?? ???? ?? ??? ????? ? ? ????. ?, Customer ???? ??? ??? ??? ??? ???? ?? ? ? ????. ?????? ?? 0?????.
Modeling
?? ??? ??? ?? ? ??? ???? ??? ??? ?????
public?class?Test2?{????public?static?void?main(String[]?args)?{????????int?index?=?3; ????????index?=?index++; ????????System.out.println(index); ????} ???? }復制代碼
?? ???? ??? ??? ??? ????? ??? ?? ?? ????.
??
?? ?? javap? ???? JVM ?????? ??? ????? ???????.
javap?-c?Test2 Compiled?from?"Test2.java"public?class?com.showyool.blog_4.Test2?{??public?com.showyool.blog_4.Test2(); ????Code:???????0:?aload_0???????1:?invokespecial?#1??????????????????//?Method?java/lang/Object."<init>":()V ???????4:?return ??public?static?void?main(java.lang.String[]); ????Code:???????0:?iconst_3???????1:?istore_1???????2:?iload_1???????3:?iinc??????????1,?1 ???????6:?istore_1???????7:?getstatic?????#2??????????????????//?Field?java/lang/System.out:Ljava/io/PrintStream; ??????10:?iload_1??????11:?invokevirtual?#3??????????????????//?Method?java/io/PrintStream.println:(I)V ??????14:?return}復制代碼
??? JVM ????? ??? ?? ???? ???????(??? ??? ?? ??? ??? ???????)
?? ?? ??? ???? ??? ?? ?? ?????? ? ?? ??? ??? ?? ??? ???. ? ? ??? ??? ?? ?? ?? ??? ?? ???? ???? ?? ??? ?????.
??? ??? ?????. ???? ???? ??? ??? ??? ???? ???? ???? ???? ???, ?? ?? ???? ??? ?? ?? ??? ???? ?????.
?? ?? ?? ??? ???????.
0: icont_3 (?? ?? 3? ??? ?????)
1: istore_1 (出棧操作,將值賦給第一個參數(shù),也就是將3賦值給index)
2: iload_1 ?(將第一個參數(shù)的值壓入棧,也就是將3入棧,此時棧頂?shù)闹禐?)
3: iinc 1, 1 (將第一個參數(shù)的值進行自增操作,那么此時index的值是4)
6: istore_1 (出棧操作,將值賦給第一個參數(shù),也就是將3賦值給index)
也就是說index這個參數(shù)的值是經(jīng)歷了index->3->4->3,所以這樣一輪操作之后,index又回到了一開始賦值的值。
延伸一下
這樣一來,我們發(fā)現(xiàn),問題其實出在最后一步,在進行運算之后,又將原先棧中記錄的值重新賦給變量,覆蓋掉了 如果我們這樣寫:
public?class?Test2?{????public?static?void?main(String[]?args)?{????????int?index?=?3; ????????index++; ????????System.out.println(index); ????} } Compiled?from?"Test2.java"public?class?com.showyool.blog_4.Test2?{??public?com.showyool.blog_4.Test2(); ????Code:???????0:?aload_0???????1:?invokespecial?#1??????????????????//?Method?java/lang/Object."<init>":()V ???????4:?return ??public?static?void?main(java.lang.String[]); ????Code:???????0:?iconst_3???????1:?istore_1???????2:?iinc??????????1,?1 ???????5:?getstatic?????#2??????????????????//?Field?java/lang/System.out:Ljava/io/PrintStream; ???????8:?iload_1???????9:?invokevirtual?#3??????????????????//?Method?java/io/PrintStream.println:(I)V ??????12:?return}復制代碼
可以發(fā)現(xiàn),這里就沒有最后一步的istore_1,那么在iinc之后,index的值就變成我們預想的4。
還有一種情況,我們來看看:
public?class?Test2?{????public?static?void?main(String[]?args)?{????????int?index?=?3; ????????index?=?index?+?2; ????????System.out.println(index); ????} } Compiled?from?"Test2.java"public?class?com.showyool.blog_4.Test2?{??public?com.showyool.blog_4.Test2(); ????Code:???????0:?aload_0???????1:?invokespecial?#1??????????????????//?Method?java/lang/Object."<init>":()V ???????4:?return ??public?static?void?main(java.lang.String[]); ????Code:???????0:?iconst_3???????1:?istore_1???????2:?iload_1???????3:?iconst_2???????4:?iadd???????5:?istore_1???????6:?getstatic?????#2??????????????????//?Field?java/lang/System.out:Ljava/io/PrintStream; ???????9:?iload_1??????10:?invokevirtual?#3??????????????????//?Method?java/io/PrintStream.println:(I)V ??????13:?return}復制代碼
0: iconst_3 (先將常量3壓入棧)
1: istore_1 (出棧操作,將值賦給第一個參數(shù),也就是將3賦值給index)
2: iload_1 ?(將第一個參數(shù)的值壓入棧,也就是將3入棧,此時棧頂?shù)闹禐?)
3: iconst_2 (將常量2壓入棧, 此時棧頂?shù)闹禐?,2在3之上)
4: iadd (將棧頂?shù)膬蓚€數(shù)進行相加,并將結(jié)果壓入棧。2+3=5,此時棧頂?shù)闹禐?)
5: istore_1 (出棧操作,將值賦給第一個參數(shù),也就是將5賦值給index)
看到這里各位觀眾老爺肯定會有這么一個疑惑,為什么這里的iadd加法操作之后,會影響棧里面的數(shù)據(jù),而先前說的iinc不是在棧里面操作?好的吧,我們可以看看JVM虛擬機規(guī)范當中,它是這么描述的:
指令iinc對給定的局部變量做自增操作,這條指令是少數(shù)幾個執(zhí)行過程中完全不修改操作數(shù)棧的指令。它接收兩個操作數(shù): 第1個局部變量表的位置,第2個位累加數(shù)。比如常見的i++,就會產(chǎn)生這條指令
看到這里,我們知道,對于一般的加法操作之后復制沒啥問題,但是使用i++之后,那么此時棧頂?shù)臄?shù)還是之前的舊值,如果此刻進行賦值就會回到原來的舊值,因為它并沒有修改棧里面的數(shù)據(jù)。所以先前那個bug,只需要進行自增不賦值就可以修復了。
???
? ?? ????? ?????. ? ??? ?? ? ??? ???? ?? ?????. ??? ?? ?? ??? ????, ? ?? ??? ??? ??? ??? ? ??? ????. ???? ?? ??? ??? ?????? ???????. ? ?? ??? ???? ???? ????? click???
? ??? i++? ?? ?? ??? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)

JDBC ????? ???? ????? ?? ?? ?? ??? ?? ?? ??? ?? ? ?? ??? ?? ?? ?? ??? ???????. 1. ????? ????? Conn.SetAutoCommit (False)?? ??????. 2. ??? ? ????? ?? ?? SQL ??? ?????. 3. ?? ??? ??? ?? Conn.commit ()?? ???? ??? ???? ???? ?? ??? ???? Conn.Rollback ()?? ??????. ???, ? ??? ???? ????, ??? ???? ????, ?? ??? ??? ?? ??? ??? ???? ? ???????. ?? ?? ?? ???? ????? ??? ???? ?? ?? ???? ???? ??? ????? ?? ??? ??? ? ?? ???? ?? ????.

?? ?? ? ?? ???? ???? ?? Java.Time ???? ???? ??????. 2. LocalDate, LocalDateTime ? LocalTime? ?? ?? ??? ??? ?????. 3. () ???? ???? ?? ??? ??? ????. 4. ???/???? ??? ???? ??? ????? ??? ??????. 5. ZonedDateTime ? Zoneid? ???? ???? ??????. 6. DateTimeFormatter? ?? ?? ? ?? ?? ?? ???; 7. ??? ?? ?? ?? ??? ????? ?? ??????. ?? Java? ?? ??? ???? ??? ??? ???? Java.Timeapi ??? ?? ??? ???????.

Pre-FormancetArtUptimeMoryUsage, Quarkusandmicronautleadduetocompile-timeprocessingandgraalvsupport, withquarkusoftenperforminglightbetterine serverless sinarios.2.thyvelopecosyste,

NetworkPortSandfirewallsworkTogetToenableCommunication whileensuringsecurity.1.networkportSarevirtualendpointsnumbered0–65535, Withwell-nownports like80 (http), 443 (https), 22 (ssh) ? 25 (smtp) ?? (specservices

Java 's Garbage Collection (GC)? ???? ???? ???? ??????, ?? ? ??? ??? ? ??? ??? ??? ??? ????. 1.GC? ?? ?? (? : ?? ??, ?? ???, ?? ?? ?)?? ??? ???? ????, ?? ? ??? ??? ???? ?????. 2. ?? ???? ????? ????, ?? ?? ??? ??? ???? ?? ??? ??????. 3. ?? ?? ?? ?? : ??? ?? (Eden, S0, S1)? ?? ????? ?????. ??? ??? ?? ? MajorGC? ???? ? ??? ? ????. Metaspace? ??? ?? ???? ?????. 4. JVM? ??? GC ??? ?????. SerialGC? ??? ?? ????? ?????. ParallelGC? ???? ??????. CMS? ?? ???

??? htmlinput ??? ???? ??? ???? ????? ??? ??? ?? ??? ???? ???? ? ????. 1. ???, ???, ??, ?? ? ??? ?? ??? ??? ?? ?? ?? ??? ???? ???? ??? ? ???? ??? ? ????. 2. HTML5? ?????? ??? ? ?? ?? ??? ?? ? ??? URL, ??, ?? ? ??? ?? ??? ??? ??????. 3. ?? ?? ? ? ??? ??? ???? ?? ??? ???? ???? ?? ???? ?? ???? ???? ?? ? ? ??? ?? ???????.

GO? HTTP ?? ????? ?? ??, ??, ????? IP ? ?? ??? ?? ? ? ????. 1. http.handlerfunc? ???? ????? ????, 2. ??? ???? ?? ?? ??? ?? ??? ??????. ?? ?? ??? ???? ??? ?????? ??? ????? ???? ? ?????. ?? ???? ?? ?? ??, JSON ?? ?? ? ?? ID ??? ?????.

GradleisBetTerChoiceFormostNewProjectSduetoitssuperiorflexible, Performance, and ModernToolingsupport.1.Gradle'Sgroovy/kotlindslismoreConcisENDEXPRESSIVETHANMAVEN'SVOSEXML.2.GradleOutsMaveninbuildweedweedweedweedweedweedweedweedweedweedweedweedweedweede
