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ù),這里就簡(jiǎn)單模擬 ????????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; ????} }復(fù)制代碼
? ??? ???? ?? ??? ????. ?? Customer ???? 2?? ??? ??? ???? ?????. ??? ?? ??? ??? ????. ??? ??? ?? ?? ?????. ??? ?? ? ??? ??? ?????.
?? ?? ???? ?? ???? ?? ??? ????? ? ? ????. ?, Customer ???? ??? ??? ??? ??? ???? ?? ? ? ????. ?????? ?? 0?????.
Modeling
?? ??? ??? ?? ? ??? ???? ??? ??? ?????
public?class?Test2?{????public?static?void?main(String[]?args)?{????????int?index?=?3; ????????index?=?index++; ????????System.out.println(index); ????} ???? }復(fù)制代碼
?? ???? ??? ??? ??? ????? ??? ?? ?? ????.
??
?? ?? 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}復(fù)制代碼
??? JVM ????? ??? ?? ???? ???????(??? ??? ?? ??? ??? ???????)
?? ?? ??? ???? ??? ?? ?? ?????? ? ?? ??? ??? ?? ??? ???. ? ? ??? ??? ?? ?? ?? ??? ?? ???? ???? ?? ??? ?????.
??? ??? ?????. ???? ???? ??? ??? ??? ???? ???? ???? ???? ???, ?? ?? ???? ??? ?? ?? ??? ???? ?????.
?? ?? ?? ??? ???????.
0: icont_3 (?? ?? 3? ??? ?????)
1: istore_1 (出棧操作,將值賦給第一個(gè)參數(shù),也就是將3賦值給index)
2: iload_1 ?(將第一個(gè)參數(shù)的值壓入棧,也就是將3入棧,此時(shí)棧頂?shù)闹禐?)
3: iinc 1, 1 (將第一個(gè)參數(shù)的值進(jìn)行自增操作,那么此時(shí)index的值是4)
6: istore_1 (出棧操作,將值賦給第一個(gè)參數(shù),也就是將3賦值給index)
也就是說(shuō)index這個(gè)參數(shù)的值是經(jīng)歷了index->3->4->3,所以這樣一輪操作之后,index又回到了一開(kāi)始賦值的值。
延伸一下
這樣一來(lái),我們發(fā)現(xiàn),問(wèn)題其實(shí)出在最后一步,在進(jìn)行運(yùn)算之后,又將原先棧中記錄的值重新賦給變量,覆蓋掉了 如果我們這樣寫(xiě):
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ù)制代碼
可以發(fā)現(xiàn),這里就沒(méi)有最后一步的istore_1,那么在iinc之后,index的值就變成我們預(yù)想的4。
還有一種情況,我們來(lái)看看:
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}復(fù)制代碼
0: iconst_3 (先將常量3壓入棧)
1: istore_1 (出棧操作,將值賦給第一個(gè)參數(shù),也就是將3賦值給index)
2: iload_1 ?(將第一個(gè)參數(shù)的值壓入棧,也就是將3入棧,此時(shí)棧頂?shù)闹禐?)
3: iconst_2 (將常量2壓入棧, 此時(shí)棧頂?shù)闹禐?,2在3之上)
4: iadd (將棧頂?shù)膬蓚€(gè)數(shù)進(jìn)行相加,并將結(jié)果壓入棧。2+3=5,此時(shí)棧頂?shù)闹禐?)
5: istore_1 (出棧操作,將值賦給第一個(gè)參數(shù),也就是將5賦值給index)
看到這里各位觀眾老爺肯定會(huì)有這么一個(gè)疑惑,為什么這里的iadd加法操作之后,會(huì)影響棧里面的數(shù)據(jù),而先前說(shuō)的iinc不是在棧里面操作?好的吧,我們可以看看JVM虛擬機(jī)規(guī)范當(dāng)中,它是這么描述的:
指令iinc對(duì)給定的局部變量做自增操作,這條指令是少數(shù)幾個(gè)執(zhí)行過(guò)程中完全不修改操作數(shù)棧的指令。它接收兩個(gè)操作數(shù): 第1個(gè)局部變量表的位置,第2個(gè)位累加數(shù)。比如常見(jiàn)的i++,就會(huì)產(chǎn)生這條指令
看到這里,我們知道,對(duì)于一般的加法操作之后復(fù)制沒(méi)啥問(wèn)題,但是使用i++之后,那么此時(shí)棧頂?shù)臄?shù)還是之前的舊值,如果此刻進(jìn)行賦值就會(huì)回到原來(lái)的舊值,因?yàn)樗](méi)有修改棧里面的數(shù)據(jù)。所以先前那個(gè)bug,只需要進(jìn)行自增不賦值就可以修復(fù)了。
???
? ?? ????? ?????. ? ??? ?? ? ??? ???? ?? ?????. ??? ?? ?? ??? ????, ? ?? ??? ??? ??? ??? ? ??? ????. ???? ?? ??? ??? ?????? ???????. ? ?? ??? ???? ???? ????? 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? ?? ???

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

DEFER? ??? ???? ?? ??? ??? ???? ? ?????. ?? ??? ?? ? ? ?? ????, ??? ??? ? ?? ?? (LIFO)? ??? ?????. 1. ?? ??? ??? ? ??? ?????. 2. ?? ??? ?? ??? ??? ????? ?????. 3. ?? ? ?? ?? ??? ? ????. 4. ??? ?????? ??? ??? ???? ?????. 5. ?? ??? ???? ?? ??? ?? ??? ?????. ??? ??? ?? ?? ? ???? ???? ? ????.

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