"/>

鍐嶈锛孠otlin 锛佷綘濂? Java 锛?/h1>

Posted 寮€鍙戣€呮妧鏈墠绾?/a>

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了鍐嶈锛孠otlin 锛佷綘濂? Java 锛?/h1>

相关的知识,希望对你有一定的参考价值。

鐐瑰嚮鈥?/span> 寮€鍙戣€呮妧鏈墠绾?/span> 鈥濓紝閫夋嫨鈥滄槦鏍囸煍濃€?/span>

鍦ㄧ湅|鏄熸爣|鐣欒█,  鐪熺埍


浣滆€咃細Bartosz Walacik | 鏉ヨ嚜锛欳SDN |  缂栬緫 锛氬彲鍙?/span>
鍥炲鈥?66鈥濓紝鑾峰彇涓€浠戒笓灞炲ぇ绀煎寘
鍘熸枃锛歨ttps://allegro.tech/2018/05/From-Java-to-Kotlin-and-Back-Again.html


姣棤鐤戦棶锛孠otlin 鍦ㄥ幓骞村緢鍙楁杩庯紝涓氱晫鐢氳嚦鏈変汉璁や负鍏跺皢 鍙栦唬 Java 鐨勯湼涓诲湴浣?/span> 銆傚畠鎻愪緵浜?Null 瀹夊叏鎬э紝浠庤繖涓€鐐规潵璇村畠纭疄姣?Java 鏇村ソ銆傞偅涔堟槸涓嶆槸杩欏氨鎰忓懗鐫€寮€鍙戣€呭簲璇ユ涓嶇姽璞湴鎷ユ姳 Kotlin锛屽惁鍒欏氨钀戒紞浜嗭紵
绛夌瓑锛屾垨璁镐簨鎯呭苟闈炲姝ゃ€?/span>
鍦ㄥ紑濮嬩娇鐢?Kotlin 缂栫▼涔嬪墠锛屾湰鏂囨兂瑕佸垎浜釜鏁呬簨缁欎綘銆傚湪杩欎釜鏁呬簨涓紝浣滆€呮渶鏃╀娇鐢?Kotlin 鏉ョ紪鍐欎竴涓」鐩紝鍚庢潵 Kotlin 鐨勫悇绉嶆€紓妯″紡浠ュ強涓€浜涘叾浠栭殰纰嶈秺鏉ヨ秺璁╀汉鍘岀儲锛屾渶缁堬紝浠栦滑鍐冲畾閲嶅啓杩欎釜椤圭洰銆?/span>
鍐嶈锛孠otlin 锛佷綘濂? Java 锛?> 
</section> 
<section class= 浠ヤ笅涓鸿瘧鏂囷細
涓€鐩翠互鏉ワ紝鎴戝鍩轰簬 JVM 鐨勮瑷€閮介潪甯告儏鏈夌嫭閽熴€傛垜閫氬父浼氱敤 Java 鏉ョ紪鍐欎富绋嬪簭锛屽啀鐢?Groovy 缂栧啓娴嬭瘯浠g爜锛屼袱鑰呴厤鍚堜娇鐢ㄥ緱蹇冨簲鎵嬨€?/span>
2017骞村澶╋紝鍥㈤槦鍙戣捣浜嗕竴涓柊鐨勫井鏈嶅姟椤圭洰锛屽拰寰€甯镐竴鏍凤紝鎴戜滑闇€瑕佸缂栫▼璇█鍜屾妧鏈繘琛岄€夊瀷銆傞儴鍒嗗洟闃熸垚鍛樻槸 Kotlin 鐨勬嫢鎶よ€咃紝鍐嶅姞涓婃垜浠兘鎯冲皾璇曚竴涓嬫柊鐨勪笢瑗匡紝浜庢槸鎴戜滑鍐冲畾鐢?Kotlin 鏉ュ紑鍙戣繖涓」鐩€傜敱浜?Spock 娴嬭瘯妗嗘灦涓嶆敮鎸?Kotlin锛屽洜姝ゆ垜浠喅瀹氬潥鎸佷娇鐢?Groovy 鏉ユ祴璇曘€?/span>
2018骞存槬澶╋紝浣跨敤 Kotlin 寮€鍙戝嚑涓湀涔嬪悗锛屾垜浠€荤粨浜?Kotlin 鐨勪紭缂虹偣锛屾渶缁堢粨璁鸿〃鏄?Kotlin 闄嶄綆浜嗘垜浠殑鐢熶骇鍔涖€?/span>
浜庢槸鎴戜滑浣跨敤 Java 鏉ラ噸鍐欒繖涓井鏈嶅姟椤圭洰銆?/span>
閭d箞 Kotlin 涓昏瀛樺湪鍝簺寮婄锛熶笅闈㈡潵涓€涓€瑙i噴銆?/span>
鍚嶇О閬斀
杩欐槸 Kotlin 鏈€璁╂垜闇囨儕鐨勫湴鏂广€傜湅鐪嬩笅闈㈣繖涓柟娉曪細


  
    
    
  
fun inc(num : Int) {
     val num =  2
     if (num >  0) {
         val num =  3
    }
    println ( "num: " + num)
}


褰撲綘璋冪敤 inc(1) 浼氳緭鍑轰粈涔堝憿锛熷湪 Kotlin 涓? 鏂规硶鐨勫弬鏁版棤娉曚慨鏀癸紝鍥犳鍦ㄦ湰渚嬩腑浣犱笉鑳芥敼鍙?num銆傝繖涓璁″緢濂斤紝鍥犱负浣犱笉搴旇鏀瑰彉鏂规硶鐨勮緭鍏ュ弬鏁般€備絾鏄綘鍙互鐢ㄧ浉鍚岀殑鍚嶇О瀹氫箟鍙︿竴涓彉閲忓苟瀵瑰叾杩涜鍒濆鍖栥€?/span>
杩欐牱涓€鏉ワ紝杩欎釜鏂规硶浣滅敤鍩熶腑灏辨湁涓や釜鍚嶄负 num 鐨勫彉閲忋€傚綋鐒讹紝浣犱竴娆″彧鑳借闂叾涓竴涓?num锛屼絾鏄?num 鍊间細琚敼鍙樸€?/span>
鍦?if 璇彞涓啀娣诲姞鍙︿竴涓?num锛屽洜涓轰綔鐢ㄥ煙鐨勫師鍥?num 骞朵笉浼氳淇敼銆?/span>
浜庢槸锛屽湪 Kotlin 涓紝inc(1) 浼氳緭鍑?2銆傚悓鏍锋晥鏋滅殑 Java 浠g爜濡備笅鎵€绀猴紝涓嶈繃鏃犳硶閫氳繃缂栬瘧锛?nbsp;


  
    
    
  
void inc(int num{
     int num =  2//error: variable 'num' is already defined in the scope
     if (num >  0) {
         int num =  3//error: variable 'num' is already defined in the scope
    }
    System. out.println ( "num: " + num);
}


鍚嶅瓧閬斀骞朵笉鏄?Kotlin 鍙戞槑鐨勶紝杩欏湪缂栫▼璇█涓緢甯歌銆傚湪 Java 涓垜浠範鎯敤鏂规硶鍙傛暟鏉ユ槧灏勭被瀛楁锛?/span>


  
    
    
  
public  class Shadow {
    int  val;
     public Shadow(int  val) {
         this. val =  val;
    }
}


鍦?Kotlin 涓悕绉伴伄钄芥湁浜涗弗閲嶏紝杩欐槸 Kotlin 鍥㈤槦鐨勪竴涓璁$己闄枫€?/span>
IDEA 鍥㈤槦璇曞浘閫氳繃鍚戞瘡涓伄钄藉彉閲忔樉绀鸿鍛婁俊鎭潵瑙e喅杩欎釜闂銆備袱涓洟闃熷湪鍚屼竴瀹跺叕鍙稿伐浣滐紝鎴栬浠栦滑鍙互浜掔浉浜ゆ祦骞跺氨閬斀闂杈炬垚鍏辫瘑銆傛垜浠庝釜浜鸿搴﹁禐鎴?IDEA 鐨勫仛娉曞洜涓烘垜鎯充笉鍒版湁鍝簺搴旂敤鍦烘櫙闇€瑕侀伄钄芥柟娉曞弬鏁般€?/span>
绫诲瀷鎺ㄦ柇
鍦↘otlin涓紝褰撲綘澹版槑涓€涓獀ar鎴栨槸val锛屼綘閫氬父浼氳缂栬瘧鍣ㄤ粠鍙宠竟鐨勮〃杈惧紡绫诲瀷涓寽娴嬪彉閲忕被鍨嬨€傛垜浠О涔嬩负灞€閮ㄥ彉閲忕被鍨嬫帹鏂紝杩欏绋嬪簭鍛樻潵璇存槸涓€涓緢澶х殑鏀硅繘銆傚畠鍏佽鎴戜滑鍦ㄤ笉褰卞搷闈欐€佺被鍨嬫鏌ョ殑鎯呭喌涓嬬畝鍖栦唬鐮併€?/span>
渚嬪锛岃繖涓狵otlin浠g爜锛?/span>


  
    
    
  
var a =  "10"


Kotlin 缂栬瘧鍣ㄤ細灏嗗叾缈昏瘧鎴愶細 


  
    
    
  
var a :  String =  "10"


Java 鍚屾牱鍏峰杩欎釜鐗规€э紝Java 10涓殑绫诲瀷鎺ㄦ柇绀轰緥濡備笅锛?nbsp; 


  
    
    
  
var a =  "10";


瀹炶瘽瀹炶锛孠otlin 鍦ㄨ繖涓€鐐逛笂纭疄鏇磋儨涓€绛广€傚綋鐒讹紝绫诲瀷鎺ㄦ柇杩樺彲搴旂敤鍦ㄥ涓満鏅€?/span> 鍏充簬 Java 10涓殑灞€閮ㄥ彉閲忕被鍨嬫帹鏂紝鐐瑰嚮浠ヤ笅閾炬帴 浜嗚В鏇村锛?/span>
  • https://medium.com/@afinlay/java-10-sneak-peek-local-variable-type-inference-var-3022016e1a2b

Null 瀹夊叏绫诲瀷
Null 瀹夊叏绫诲瀷鏄?Kotlin 鐨勬潃鎵嬬骇鍔熻兘銆?/span>
杩欎釜鎯虫硶寰堝ソ锛屽湪 Kotlin 涓紝绫诲瀷榛樿涓嶅彲涓虹┖銆傚鏋滀綘闇€瑕佹坊鍔犱竴涓彲涓虹┖鐨勭被鍨嬶紝鍙互鍍忎笅鍒椾唬鐮佽繖鏍凤細 


  
    
    
  
val a:  String? =  null       // ok
val b:  String =  null        // compilation error


鍋囪浣犱娇鐢ㄤ簡鍙负绌虹殑鍙橀噺浣嗘槸骞舵湭杩涜绌哄€兼鏌ワ紝杩欏湪 Kotlin 灏嗘棤娉曢€氳繃缂栬瘧锛屾瘮濡傦細


  
    
    
  
println (a.length)           // compilation error
println (a?.length)          // fine, prints null
println (a?.length ?:  0)     // fine, prints 0


閭d箞鏄笉鏄鏋滀綘鍚屾椂鎷ユ湁涓嶅彲涓虹┖鍜屽彲涓虹┖鐨勫彉閲忥紝灏卞彲浠ラ伩鍏?Java 涓渶甯歌鐨?NullPointerException 寮傚父鍚楋紵浜嬪疄骞舵病鏈夋兂璞$殑绠€鍗曘€?/span>
褰?Kotlin 浠g爜蹇呴』璋冪敤 Java 浠g爜鏃讹紝浜嬫儏浼氬彉寰楀緢绯熺硶锛屾瘮濡傚簱鏄敤 Java 缂栧啓鐨勶紝鎴戠浉淇¤繖绉嶆儏鍐靛緢甯歌銆備簬鏄涓夌绫诲瀷浜х敓浜嗭紝瀹冭绉颁负骞冲彴绫诲瀷銆侹otlin 鏃犳硶琛ㄧず杩欑濂囨€殑绫诲瀷锛屽畠鍙兘浠?Java 绫诲瀷鎺ㄦ柇鍑烘潵銆傚畠鍙兘浼氳瀵间綘锛屽洜涓哄畠瀵圭┖鍊煎緢瀹芥澗锛屽苟涓斾細绂佺敤 Kotlin 鐨?NULL 瀹夊叏鏈哄埗銆?/span>
鐪嬬湅涓嬮潰杩欎釜 Java 鏂规硶锛?/span>


  
    
    
  
public  class  Utils {
     static String format(String text{
         return text.isEmpty() ?  null : text;
    }
}


鍋囧浣犳兂璋冪敤 format(String)銆傚簲璇ヤ娇鐢ㄥ摢绉嶇被鍨嬫潵鑾峰緱杩欎釜 Java 鏂规硶鐨勭粨鏋滃憿锛熶綘鏈変笁涓€夋嫨銆?/span>
绗竴绉嶆柟娉曪細浣犲彲浠ヤ娇鐢?String锛屼唬鐮佺湅璧锋潵寰堝畨鍏紝浣嗘槸浼氭姏鍑?NullPointerException 寮傚父 銆?/span>


  
    
    
  
fun doSth(text: String) {
     val f: String = Utils.format(text)        // compiles but assignment can throw NPE at runtime
    println ( "f.len : " + f.length)
}


閭d綘灏遍渶瑕佺敤 Elvis 鏉ヨВ鍐宠繖涓棶棰橈細


  
    
    
  
fun doSth(text: String) {
     val f: String = Utils.format(text) ?:  ""   // safe with Elvis
    println ( "f.len : " + f.length)
}


绗簩绉嶆柟娉曪細浣犲彲浠ヤ娇鐢?String锛岃兘澶熶繚璇?Null 瀹夊叏鎬с€?/span>


  
    
    
  
fun doSth(text: String) {
     val f: String? = Utils.format(text)    // safe
    println ( "f.len : " + f.length)        // compilation error, fine
    println ( "f.len : " + f?.length)       // null-safe with ? operator
}


绗笁绉嶆柟娉曪細璁?Kotlin 鍋氬眬閮ㄥ彉閲忕被鍨嬫帹鏂浣曪紵 


  
    
    
  
fun doSth(text: String) {
     val f = Utils.format(text)             // f type inferred as String!
    println ( "f.len : " + f.length)        // compiles but can throw NPE at runtime
}


棣婁富鎰忥紒杩欎釜 Kotlin 浠g爜鐪嬭捣鏉ュ緢瀹夊叏銆佸彲缂栬瘧锛屼絾鏄畠瀹瑰繊浜嗙┖鍊硷紝灏卞儚鍦?Java 涓竴鏍枫€?/span>
闄ゆ涔嬪锛岃繕鏈夊彟澶栦竴涓柟娉曪紝灏辨槸寮哄埗灏?f 绫诲瀷鎺ㄦ柇涓?String锛?/span>


  
    
    
  
fun doSth(text: String) {
     val f = Utils.format(text)!!           // throws NPE when format() returns null
    println ( "f.len : " + f.length)
}


鍦ㄦ垜鐪嬫潵锛孠otlin 鐨勬墍鏈夎繖浜涚被浼?scala 鐨勭被鍨嬬郴缁熻繃浜庡鏉傘€侸ava 浜掓搷浣滄€т技涔庢崯瀹充簡 Kotlin 绫诲瀷鎺ㄦ柇杩欎釜閲嶉噺绾у姛鑳姐€?/span>
绫诲悕绉板瓧闈㈠父閲?/span>
浣跨敤绫讳技 Log4j 鎴栬€?Gson 鐨?Java 搴撴椂锛岀被鏂囧瓧寰堝父瑙併€?/span>
Java 浣跨敤 .class 鍚庣紑缂栧啓绫诲悕锛?nbsp;


  
    
    
  
Gson gson =  new GsonBuilder().registerTypeAdapter(LocalDate.class,  new LocalDateAdapter()).create();


Groovy 鎶婄被杩涜浜嗚繘涓€姝ョ殑绠€鍖栥€備綘鍙互蹇界暐 .class锛屽畠鏄?Groovy 鎴栬€?Java 绫诲苟涓嶉噸瑕併€?/span>


  
    
    
  
def gson = new GsonBuilder().registerTypeAdapter(LocalDate, new LocalDateAdapter()).create()


Kotlin 鎶?Kotlin 绫诲拰 Java 绫昏繘琛屼簡鍖哄垎锛屽苟涓哄叾鎻愪緵浜嗚娉曡鑼冿細


  
    
    
  
val kotlinClass : KClass<LocalDate> = LocalDate:: class
val javaClass : Class<LocalDate> = LocalDate:: class.java


鍥犳鍦?Kotlin 涓紝浣犲繀椤诲啓鎴愬涓嬪舰寮忥細


  
    
    
  
val gson = GsonBuilder().registerTypeAdapter(LocalDate:: class.javaLocalDateAdapter()).create()


杩欑湅璧锋潵闈炲父涓戦檵銆?/span>
鍙嶅悜绫诲瀷澹版槑
C 绯诲垪鐨勭紪绋嬭瑷€鏈夋爣鍑嗙殑澹版槑绫诲瀷鐨勬柟娉曘€傜畝鑰岃█涔嬶紝棣栧厛鎸囧畾涓€涓被鍨嬶紝鐒跺悗鏄绗﹀悎绫诲瀷鐨勪笢瑗匡紝姣斿鍙橀噺銆佸瓧娈点€佹柟娉曠瓑绛夈€?/span>
Java 涓殑琛ㄧず鏂规硶鏄細


  
    
    
  
int inc(int i) {
     return i +  1;
}


Kotlin 涓垯鏄細


  
    
    
  
fun inc(i: Int)Int {
     return i +  1
}


杩欑鏂规硶鏈夊嚑涓師鍥犱护浜鸿鍘屻€?/span>
棣栧厛锛屼綘闇€瑕佸湪鍚嶇О鍜岀被鍨嬩箣闂村姞鍏ヨ繖涓浣欑殑鍐掑彿銆傝繖涓澶栬鑹茬殑鐩殑鏄粈涔堬紵涓轰粈涔堝悕绉颁笌鍏剁被鍨嬭鍒嗙锛熸垜涓嶇煡閬撱€傚彲鎮茬殑鏄紝杩欒浣犲湪 Kotlin 鐨勫伐浣滃彉寰楁洿鍔犲洶闅俱€?/span>
绗簩涓棶棰橈紝褰撲綘璇诲彇涓€涓柟娉曞0鏄庢椂锛屼綘棣栧厛鐪嬪埌鐨勬槸鍚嶅瓧鍜岃繑鍥炵被鍨嬶紝鐒跺悗鎵嶆槸鍙傛暟銆?/span>
鍦?Kotlin 涓紝鏂规硶鐨勮繑鍥炵被鍨嬪彲鑳借繙鍦ㄨ灏撅紝鎵€浠ラ渶瑕佹祻瑙堝緢澶氫唬鐮佹墠鑳界湅鍒帮細 


  
    
    
  
private  fun getMetricValue(kafkaTemplate : KafkaTemplate<String, ByteArray>, metricName : String) :  Double {
    ...
}


鎴栬€咃紝濡傛灉鍙傛暟鏄€愯鏍煎紡鐨勶紝鍒欓渶瑕佹悳绱€傞偅涔堟垜浠渶瑕佸灏戞椂闂存墠鑳芥壘鍒版鏂规硶鐨勮繑鍥炵被鍨嬪憿锛?/span>


  
    
    
  
@Bean
fun kafkaTemplate(
        @Value("${interactions.kafka.bootstrap-servers-dc1}") bootstrapServersDc1: String,
        @Value("${interactions.kafka.bootstrap-servers-dc2}") bootstrapServersDc2: String,
        cloudMetadata: CloudMetadata,
        @Value("${interactions.kafka.batch-size}") batchSize: Int,
        @Value("${interactions.kafka.linger-ms}") lingerMs: Int,
        metricRegistry : MetricRegistry
)
: KafkaTemplate<String, ByteArray> {
     val bootstrapServer =  if (cloudMetadata.datacenter ==  "dc1") {
        bootstrapServersDc1
    }
    ...
}


绗笁涓棶棰樻槸 IDE 涓殑鑷姩鍖栨敮鎸佷笉澶熷ソ銆傛爣鍑嗗仛娉曚粠绫诲瀷鍚嶇О寮€濮嬶紝骞朵笖寰堝鏄撴壘鍒扮被鍨嬨€備竴鏃﹂€夋嫨涓€涓被鍨嬶紝IDE 浼氭彁渚涗竴浜涘叧浜庡彉閲忓悕鐨勫缓璁紝杩欎簺鍙橀噺鍚嶆槸浠庨€夊畾鐨勭被鍨嬫淳鐢熺殑锛屽洜姝や綘鍙互蹇€熻緭鍏ヨ繖鏍风殑鍙橀噺锛?nbsp;


  
    
    
  
MongoExperimentsRepository repository


Kotlin 灏界鏈?IntelliJ 杩欐牱寮哄ぇ鐨?IDE锛岃緭鍏ュ彉閲忎粛鐒舵槸寰堥毦鐨勩€傚鏋滀綘鏈夊涓瓨鍌ㄥ簱锛屽湪鍒楄〃涓緢闅惧疄鐜版纭殑鑷姩琛ュ叏锛岃繖鎰忓懗鐫€浣犱笉寰椾笉鎵嬪姩杈撳叆瀹屾暣鐨勫彉閲忓悕绉般€?/span>


  
    
    
  
repository : MongoExperimentsRepository


浼寸敓瀵硅薄
涓€浣?Java 绋嬪簭鍛樻潵鍒?Kotlin 闈㈠墠銆?/span>
鈥滃棬锛孠otlin銆傛垜鏄柊鏉ョ殑锛屾垜鍙互浣跨敤闈欐€佹垚鍛樺悧锛?浠栭棶銆?/span>
 鈥滀笉琛屻€傛垜鏄潰鍚戝璞$殑锛岄潤鎬佹垚鍛樹笉鏄潰鍚戝璞$殑銆傗€?Kotlin 鍥炵瓟銆?/span>
 鈥滃ソ鍚э紝浣嗘垜闇€瑕?MyClass 鐨?logger锛屾垜璇ユ€庝箞鍔烇紵鈥?nbsp;
鈥滆繖涓病闂锛屼娇鐢ㄤ即鐢熷璞″嵆鍙€傗€?/span>
 鈥滈偅鏄粈涔堜笢瑗匡紵鈥?鈥滆繖鏄眬闄愬埌浣犵殑绫荤殑鍗曠嫭瀵硅薄銆傛妸浣犵殑 logger 鏀惧湪浼寸敓瀵硅薄涓€傗€滽otlin瑙i噴璇淬€?/span>
 鈥滄垜鎳備簡銆傝繖鏍峰鍚楋紵鈥?/span>


  
    
    
  
class MyClass {
     companion  object {
         val logger = LoggerFactory.getLogger(MyClass:: class.java)
    }
}


鈥滄纭紒鈥?/span>
 鈥滃緢璇︾粏鐨勮娉曪紝鈥濈▼搴忓憳鐪嬭捣鏉ュ緢鐤戞儜锛屸€滀絾鏄病鍏崇郴锛岀幇鍦ㄦ垜鍙互鍍?MyClass.logger 杩欐牱璋冪敤鎴戠殑 logger锛屽氨鍍?Java 涓殑涓€涓潤鎬佹垚鍛橈紵鈥?nbsp;
鈥滃棷......鏄殑锛屼絾瀹冧笉鏄潤鎬佹垚鍛橈紒杩欓噷鍙湁瀵硅薄銆傛妸瀹冪湅浣滄槸宸茬粡瀹炰緥鍖栦负鍗曚緥鐨勫尶鍚嶅唴閮ㄧ被銆備簨瀹炰笂锛岃繖涓被骞朵笉鏄尶鍚嶇殑锛屽畠鐨勫悕瀛楁槸 Companion锛屼絾浣犲彲浠ョ渷鐣ヨ繖涓悕瀛椼€傜湅鍒颁簡鍚楋紵杩欏緢绠€鍗曘€?
鎴戝緢娆h祻瀵硅薄澹版槑鐨勬蹇碘€斺€斿崟渚嬪緢鏈夌敤銆備絾浠庤瑷€涓垹闄ら潤鎬佹垚鍛樻槸涓嶅垏瀹為檯鐨勩€傚湪 Java 涓垜浠娇鐢ㄩ潤鎬?Logger 寰堢粡鍏革紝瀹冨彧鏄竴涓?Logger锛屾墍浠ユ垜浠笉鍏冲績闈㈠悜瀵硅薄鐨勭函搴︺€傚畠鑳藉宸ヤ綔锛屼粠鏉ユ病鏈変换浣曞潖澶勩€?/span>
鍥犱负鏈夋椂鍊欎綘蹇呴』浣跨敤闈欐€併€傛棫鐗堟湰 public static void main() 浠嶇劧鏄惎鍔?Java 搴旂敤绋嬪簭鐨勫敮涓€鏂瑰紡銆?/span>


  
    
    
  
class AppRunner {
     companion  object {
         @JvmStatic  fun main(args: Array<String>) {
            SpringApplication.run(AppRunner:: class.java*args)
        }
    }
}


闆嗗悎瀛楅潰閲?/span>
鍦↗ava涓紝鍒濆鍖栧垪琛ㄩ潪甯哥箒鐞愶細


  
    
    
  
import java.util.Arrays;
...
List< String> strings = Arrays.asList( "Saab""Volvo");


鍒濆鍖栧湴鍥鹃潪甯稿啑闀匡紝寰堝浜轰娇鐢?Guava锛?/span>


  
    
    
  
import com.google.common.collect.ImmutableMap;
...
Map< StringString> string = ImmutableMap.of( "firstName""John""lastName""Doe");


鍦?Java 涓紝鎴戜滑浠嶇劧鍦ㄧ瓑寰呮柊鐨勮娉曟潵琛ㄨ揪闆嗗悎鍜屾槧灏勩€傝娉曞湪璁稿璇█涓潪甯歌嚜鐒跺拰鏂逛究銆?/span>
JavaScript锛?/span>


  
    
    
  
const  list = [ 'Saab''Volvo']
const map = { 'firstName''John''lastName' :  'Doe'}


Python锛?/span>


  
    
    
  
list = [ 'Saab''Volvo']
map = { 'firstName''John''lastName''Doe'}


Groovy锛?/span>


  
    
    
  
def list = [ 'Saab''Volvo']
def map = [ 'firstName''John''lastName''Doe']


绠€鍗曟潵璇达紝闆嗗悎瀛楅潰閲忕殑鏁撮綈璇硶灏辨槸浣犲鐜颁唬缂栫▼璇█鐨勬湡鏈涳紝鐗瑰埆鏄鏋滃畠鏄粠澶村紑濮嬪垱寤虹殑銆侹otlin 鎻愪緵浜嗕竴绯诲垪鍐呯疆鍑芥暟锛屾瘮濡?listOf()銆乵utableListOf()銆乵apOf()銆乭ashMapOf() 绛夌瓑銆?/span>
Kotlin锛?nbsp;


  
    
    
  
val  list = listOf( "Saab""Volvo")
val  map = mapOf( "firstName" to  "John""lastName" to  "Doe")


鍦ㄥ湴鍥句腑锛岄敭鍜屽€间笌 to 杩愮畻绗﹂厤瀵癸紝杩欏緢濂姐€備絾涓轰粈涔堜竴鐩存病鏈夊緱鍒板箍娉涗娇鐢ㄥ憿锛熶护浜哄け鏈涖€?/span>
Maybe
鍑芥暟寮忚瑷€锛堟瘮濡?Haskell锛夋病鏈夌┖鍊笺€傜浉鍙嶏紝浠栦滑鎻愪緵 Maybe monad锛堝鏋滀綘涓嶇啛鎮塵onad锛岃闃呰 Tomasz Nurkiewicz 鐨勮繖绡囨枃绔狅細 http://www.nurkiewicz.com/2016/06/functor-and-monad-examples-in-plain-java.html 锛夈€?/span>
Maybe 寰堜箙浠ュ墠灏辫 Scala 浠?Option 寮曞叆鍒?JVM 涓栫晫锛岀劧鍚庡湪 Java 8 涓閲囩敤涓?Optional銆傚浠婏紝Optional 鏄湪 API 杈圭晫澶勭悊杩斿洖绫诲瀷涓殑绌哄€肩殑闈炲父娴佽鐨勬柟寮忋€?/span>
Kotlin 涓病鏈?Optional 鐨勭瓑浠风墿锛屾墍浠ヤ綘澶ф搴旇浣跨敤 Kotlin 鐨勫彲绌虹被鍨嬨€傝鎴戜滑鏉ヨ皟鏌ヤ竴涓嬭繖涓棶棰樸€?/span>
閫氬父鎯呭喌涓嬶紝褰撲綘鏈変竴涓?Optional 鐨勬椂鍊欙紝浣犳兂瑕佸簲鐢ㄤ竴绯诲垪鏃犳晥鐨勮浆鎹€?/span>
渚嬪锛屽湪 Java 涓細 


  
    
    
  
public int parseAndInc(String number) {
     return Optional.ofNullable(number)
                   . map(Integer::parseInt)
                   . map(it -> it +  1)
                   .orElse( 0);
}


鍦?Kotlin 涓紝涓轰簡鏄犲皠浣犲彲浠ヤ娇鐢?let 鍑芥暟锛?/span>


  
    
    
  
fun parseAndInc(number: String?)Int {
     return number.let { Integer.parseInt(it) }
                 .let { it -> it +  1 } ?:  0
}


涓婇潰鐨勪唬鐮佹槸閿欒鐨勶紝parseInt() 浼氭姏鍑?NPE 銆俶ap() 浠呭湪鏈夊€兼椂鎵ц銆傚惁鍒欙紝Null 灏变細璺宠繃锛岃繖灏辨槸涓轰粈涔?map() 濡傛鏂逛究銆備笉骞哥殑鏄紝Kotlin 鐨?let 涓嶄細閭f牱宸ヤ綔銆傚畠浠庡乏渚х殑鎵€鏈夊唴瀹逛腑璋冪敤锛屽寘鎷┖鍊笺€?/span>
涓轰簡淇濊瘉杩欎釜浠g爜 Null 瀹夊叏锛屼綘蹇呴』鍦ㄦ瘡涓唬鐮佷箣鍓嶆坊鍔?let锛?nbsp;


  
    
    
  
fun parseAndInc(number: String?)Int {
     return number?.let { Integer.parseInt(it) }
                 ?.let { it -> it +  1 } ?:  0
}


鐜板湪锛屾瘮杈?Java 鍜?Kotlin 鐗堟湰鐨勫彲璇绘€с€備綘鏇村€惧悜鍝釜锛?/span>
鏁版嵁绫?/span>
鏁版嵁绫绘槸 Kotlin 鍦ㄥ疄鐜?Value Objects 鏃朵娇鐢ㄧ殑鏂规硶锛屼互鍑忓皯 Java 涓笉鍙伩鍏嶇殑鏍锋澘闂銆?/span>
渚嬪锛屽湪 Kotlin 涓紝浣犲彧鍐欎竴涓?Value Object 锛?/span>


  
    
    
  
data  class User( val name: String,  val age:  Int)


Kotlin 瀵?equals()銆乭ashCode()銆乼oString() 浠ュ強 copy() 鏈夊緢濂界殑瀹炵幇銆傚湪瀹炵幇绠€鍗曠殑DTO 鏃跺畠闈炲父鏈夌敤銆備絾璇疯浣忥紝鏁版嵁绫诲甫鏈変弗閲嶇殑灞€闄愭€с€備綘鏃犳硶鎵╁睍鏁版嵁绫绘垨鑰呭皢鍏舵娊璞″寲锛屾墍浠ヤ綘鍙兘涓嶄細鍦ㄦ牳蹇冩ā鍨嬩腑浣跨敤瀹冧滑銆?/span>
杩欎釜闄愬埗涓嶆槸 Kotlin 鐨勯敊銆傚湪 equals() 娌℃湁杩濆弽 Liskov 鍘熷垯鐨勬儏鍐典笅锛屾病鏈夊姙娉曚骇鐢熸纭殑鍩轰簬浠峰€肩殑鏁版嵁銆?/span>
杩欎篃鏄负浠€涔?Kotlin 涓嶅厑璁告暟鎹被缁ф壙鐨勫師鍥犮€?/span>
寮€鏀剧被
Kotlin 绫婚粯璁や负 final銆傚鏋滀綘鎯虫墿灞曚竴涓被锛屽繀椤绘坊鍔?open 淇グ绗︺€?/span>
缁ф壙璇硶濡備笅鎵€绀猴細 


  
    
    
  
open  class Base
class Derived : Base()


Kotlin 灏?extends 鍏抽敭瀛楁洿鏀逛负: 杩愮畻绗︼紝璇ヨ繍绠楃鐢ㄤ簬灏嗗彉閲忓悕绉颁笌鍏剁被鍨嬪垎寮€銆傞偅涔堝啀鍥炲埌 C ++璇硶锛熷鎴戞潵璇磋繖寰堟贩涔便€?/span>
杩欓噷鏈変簤璁殑鏄紝榛樿鎯呭喌涓嬬被鏄?final銆備篃璁?Java 绋嬪簭鍛樿繃搴︿娇鐢ㄧ户鎵匡紝涔熻搴旇鍦ㄨ€冭檻鎵╁睍绫讳箣鍓嶈€冭檻涓夋銆備絾鎴戜滑鐢熸椿鍦ㄦ鏋朵笘鐣岋紝Spring 浣跨敤 cglib銆乯assist 搴撲负浣犵殑 bean 鐢熸垚鍔ㄦ€佷唬鐞嗐€侶ibernate 鎵╁睍浣犵殑瀹炰綋浠ュ惎鐢ㄥ欢杩熷姞杞姐€?/span>
濡傛灉浣犱娇鐢?Spring锛屼綘鏈変袱绉嶉€夋嫨銆備綘鍙互鍦ㄦ墍鏈?bean 绫荤殑鍓嶉潰娣诲姞 open锛屾垨鑰呬娇鐢ㄨ繖涓紪璇戝櫒鎻掍欢锛?nbsp;


  
    
    
  
buildscript {
     dependencies {
         classpath group:  'org.jetbrains.kotlin', name:  'kotlin-allopen', version:  "$versions.kotlin"
    }
}


闄″抄鐨勫涔犳洸绾?/span>
濡傛灉浣犺涓鸿嚜宸辨湁 Java 鍩虹灏卞彲浠ュ揩閫熷涔?Kotlin锛岄偅浣犲氨閿欎簡銆侹otlin 浼氳浣犻櫡鍏ユ繁娓婏紝浜嬪疄涓婏紝Kotlin 鐨勮娉曟洿鎺ヨ繎 Scala銆傝繖鏄竴椤硅祵娉紝浣犲皢涓嶅緱涓嶅繕璁?Java 骞跺垏鎹㈠埌瀹屽叏涓嶅悓鐨勮瑷€銆?/span>
鐩稿弽锛屽涔?Groovy 鏄竴涓剦蹇殑杩囩▼銆侸ava 浠g爜鏄纭殑 Groovy 浠g爜锛屽洜姝や綘鍙互閫氳繃灏嗘枃浠舵墿灞曞悕浠?.java 鏇存敼涓?.groovy銆?/span>
鏈€鍚庣殑鎯虫硶
瀛︿範鏂版妧鏈氨鍍忎竴椤规姇璧勩€傛垜浠姇鍏ユ椂闂达紝鏂版妧鏈鎴戜滑寰楀埌鍥炴姤銆備絾鎴戝苟涓嶆槸璇?Kotlin 鏄竴绉嶇碂绯曠殑璇█锛屽彧鏄?/span> 鍦ㄦ垜浠殑妗堜緥涓紝鎴愭湰杩滆秴鏀剁泭銆?/span>
浠ヤ笂鍐呭缂栬瘧鑷?From Java to Kotlin and Back Again锛?/span>浣滆€?Kotlin ketckup銆?/span>
浠栨槸涓€鍚嶅叿鏈?5骞翠互涓婁笓涓氱粡楠岀殑杞欢宸ョ▼甯堬紝涓撴敞浜嶫VM 銆傚湪 Allegro锛屼粬鏄竴鍚嶅紑鍙戝洟闃熻礋璐d汉锛孞aVers 椤圭洰璐熻矗浜猴紝Spock 鍊″鑰呫€傛澶栵紝浠栬繕鏄?allegro.tech/blog 鐨勪富缂栥€?/span>
鏈枃涓€鍑哄氨寮曞彂浜嗕笟鍐呯殑骞挎硾浜夎锛?span class="mq-680">Kotlin 璇█鎷ユ姢鑰?nbsp;M谩rton Braun 灏辫〃绀轰簡寮虹儓鐨勫弽瀵广€?/span>
M谩rton Braun 鍗佸垎 鍠滄 Kotlin 缂栫▼锛岀洰鍓嶄粬鍦?StackOverflow 涓?Kotlin 鏍囩鐨勬渶楂樼敤鎴峰垪琛ㄤ腑鎺掑悕绗笁锛屽苟涓旀槸涓や釜寮€婧?Kotlin 搴撶殑鍒涘缓鑰咃紝鏈€钁楀悕鐨勬槸 MaterialDrawerKt銆傛澶栦粬杩樻槸 Autosoft 鐨?Android 寮€鍙戜汉鍛橈紝鐩墠姝e湪甯冭揪浣╂柉鎶€鏈粡娴庡ぇ瀛︽敾璇昏绠楁満宸ョ▼纭曞+瀛︿綅銆?/span>

浠ヤ笅灏辨槸浠栭拡瀵逛笂鏂囩殑鍙嶉┏锛?/span>
褰撴垜绗竴娆$湅鍒拌繖绡囨枃绔犳椂锛屾垜灏辨兂鎶婂畠杞彂鍑烘潵鐪嬬湅澶у浼氭€庝箞鎯筹紝鎴戣偗瀹氬畠浼氭槸涓€涓湁浜夎鐨勮瘽棰樸€?/span> 鍚庢潵鎴戣浜嗚繖绡囨枃绔狅紝鏋滅劧璇佹槑浜嗗畠鏄竴绉嶄富瑙傜殑銆佷笉鐪熷疄鐨勩€佺敋鑷虫湁浜涘眳楂樹复涓嬬殑鍋忚銆?/span>
鏈変簺浜哄凡缁忓湪鍘熻创涓嬭繘琛屼簡鍚堢悊鐨勬壒璇勶紝瀵规鎴戜篃鎯宠〃杈句竴涓嬭嚜宸辩殑鐪嬫硶銆?/span>
鍚嶇О閬斀
鈥淚DEA 鍥㈤槦鈥濓紙鎴栬€?Kotlin 鎻掍欢鍥㈤槦锛夊拰鈥淜otlin 鍥㈤槦鈥濊偗瀹氭槸鍚屾牱鐨勪汉锛屾垜浠庝笉璁や负鍐呴儴鍐茬獊浼氭槸涓ソ浜嬨€?/span> 璇█鎻愪緵杩欎釜鍔熻兘缁欎綘锛屼綘闇€瑕佺殑璇濆氨浣跨敤锛屽鏋滆鍘岋紝璋冩暣妫€鏌ヨ缃氨鏄簡銆?/span>
绫诲瀷鎺ㄦ柇
Kotlin 鐨勭被鍨嬫帹鏂棤澶勪笉鍦紝浣滆€呰鐨?Java 10 鍚屾牱鍙互绠€鐩存槸鍦ㄥ紑鐜╃瑧銆?/span>
Kotlin 鐨勬柟寮忚秴瓒婁簡鎺ㄦ柇灞€閮ㄥ彉閲忕被鍨嬫垨杩斿洖琛ㄨ揪寮忎綋鐨勫嚱鏁扮被鍨嬨€傝繖閲屼粙缁嶇殑杩欎袱涓緥瀛愭槸閭d簺鍒氬垰鐪嬭繃鍏充簬 Kotlin 鐨勭涓€娆′粙缁嶆€ц璇濈殑浜轰細鎻愬埌鐨勶紝鑰屼笉鏄偅浜涜姳浜嗗崐骞村涔犺璇█鐨勪汉銆?/span>
渚嬪锛屼綘鎬庝箞鑳戒笉鎻?Kotlin 鎺ㄦ柇娉涘瀷绫诲瀷鍙傛暟鐨勬柟寮忥紵杩欎笉鏄?Kotlin 鐨勪竴娆℃€у姛鑳斤紝瀹冩繁娣辫瀺鍏ヤ簡鏁翠釜璇█銆?/span>
缂栬瘧鏃?Null 瀹夊叏
杩欎釜鎵硅瘎鏄鐨勶紝褰撲綘涓?Java 浠g爜杩涜浜掓搷浣滄椂锛孨ull 瀹夊叏鎬х‘瀹炶鐮村潖浜嗐€傝璇█鑳屽悗鐨勫洟闃熸浘澶氭澹版槑锛屼粬浠渶鍒濊瘯鍥句娇 Java 鍙负绌虹殑姣忕绫诲瀷锛屼絾浠栦滑鍙戠幇瀹冨疄闄呬笂璁╀唬鐮佸彉寰楁洿绯熺硶銆?/span>
Kotlin 涓嶆瘮 Java 鏇村樊锛屼綘鍙渶瑕佹敞鎰忎娇鐢ㄧ粰瀹氬簱鐨勬柟寮忥紝灏卞儚鍦?Java 涓娇鐢ㄥ畠涓€鏍凤紝鍥犱负瀹冨苟娌℃湁涓嶅幓鑰冭檻 Null 瀹夊叏銆傚鏋?Java 搴撳叧蹇?Null  瀹夊叏鎬э紝鍒欏畠浠細鏈夎澶氭敮鎸佹敞閲婂彲渚涙坊鍔犮€?/span>
涔熻鍙互娣诲姞涓€涓紪璇戝櫒鏍囧織锛屼娇姣忕 Java 绫诲瀷閮藉彲浠ヤ负绌猴紝浣嗚繖瀵?Kotlin 鍥㈤槦鏉ヨ涓嶅緱涓嶈姳璐瑰ぇ閲忛澶栬祫婧愩€?/span>
绫诲悕绉板瓧闈㈠父閲?/span>
:: class 涓轰綘鎻愪緵浜嗕竴涓?KClass 瀹炰緥锛屼互渚夸笌 Kotlin 鑷繁鐨勫弽灏?API 涓€璧蜂娇鐢紝鑰?: class.java涓轰綘鎻愪緵浜嗙敤浜?Java 鍙嶅皠鐨勫父瑙?Java 绫诲疄渚嬨€?/span>
鍙嶅悜绫诲瀷澹版槑
涓轰簡娓呮璧疯锛岄鍊掔殑椤哄簭鏄瓨鍦ㄧ殑锛岃繖鏍蜂綘灏卞彲浠ヤ互鍚堢悊鐨勬柟寮忕渷鐣ユ樉寮忕被鍨嬨€?/span> 鍐掑彿鍙槸璇硶锛岃繖鍦ㄧ幇浠h瑷€涓槸鐩稿綋鏅亶鐨勪竴绉嶏紝姣斿 Scala銆丼wift 绛夈€?/span>
鎴戜笉鐭ラ亾浣滆€呭湪浣跨敤浠€涔?IntelliJ锛屼絾鎴戜娇鐢ㄧ殑鍙橀噺鍚嶇О鍜岀被鍨嬮兘鑳藉鑷姩琛ュ叏銆傚浜庡弬鏁帮紝IntelliJ 鐢氳嚦浼氱粰浣犳彁渚涚浉鍚岀被鍨嬬殑鍚嶇О鍜岀被鍨嬬殑寤鸿锛岃繖瀹為檯涓婃瘮 Java 鏇村ソ銆?/span>
浼寸敓瀵硅薄
鍘熸枃涓锛?/span>
鏈夋椂鍊欎綘蹇呴』浣跨敤闈欐€併€傛棫鐗堟湰 public static void main() 浠嶇劧鏄惎鍔?Java 搴旂敤绋嬪簭鐨勫敮涓€鏂瑰紡銆?/span>


  
    
    
  
class AppRunner {
     companion  object {
         @JvmStatic  fun main(args: Array<String>) {
            SpringApplication.run(AppRunner:: class.java*args)
        }
    }
}


瀹為檯涓婏紝杩欎笉鏄惎鍔?Java 搴旂敤绋嬪簭鐨勫敮涓€鏂瑰紡銆備綘鍙互杩欐牱鍋氾細


  
    
    
  
  fun main(args锛欰rray <String>){ SpringApplication.run(AppRunner ::  class.java锛? args)} 


鎴栬€呰繖鏍凤細


  
    
    
  
  fun main(args锛欰rray <String>){ runApplication <AppRunner>(* args)}


闆嗗悎瀛楅潰閲?/span>
浣犲彲浠ュ湪娉ㄩ噴涓娇鐢ㄦ暟缁勬枃瀛椼€備絾鏄紝闄ゆ涔嬪锛岃繖浜涢泦鍚堝伐鍘傜殑鍔熻兘闈炲父绠€娲侊紝鑰屼笖瀹冧滑鏄彟涓€绉嶁€滃唴缃€濆埌璇ヨ瑷€鐨勪笢瑗匡紝鑰屽畠浠疄闄呬笂鍙槸搴撳嚱鏁般€?/span>
浣犲彧鏄姳鎬ㄤ娇鐢?杩涜绫诲瀷澹版槑銆傝€屼笖锛屼负浜嗚幏寰楀畠涓嶅繀鏄崟鐙殑璇█缁撴瀯鐨勫ソ澶勶紝瀹冨彧鏄竴涓换浣曚汉閮藉彲浠ュ疄鐜扮殑鍔熻兘銆?/span>
Maybe
濡傛灉浣犲枩娆?Optional 锛屼綘鍙互浣跨敤瀹冦€侹otlin 鍦?JVM 涓婅繍琛屻€?/span>
瀵逛簬浠g爜纭疄杩欐湁浜涢毦鐪嬨€備絾鏄綘涓嶅簲璇ュ湪 Kotlin 浠g爜涓娇鐢?parseInt锛岃€屽簲璇ヨ繖鏍峰仛锛堟垜涓嶇煡閬撲綘浣跨敤璇ヨ瑷€鐨?6 涓湀涓负浣曢敊杩囪繖涓級銆備綘涓轰粈涔堣鏄庣‘鍦板懡鍚嶄竴涓?Lambda 鍙傛暟鍛紵
鏁版嵁绫?/span>
鍘熸枃涓锛?/span>
杩欎釜闄愬埗涓嶆槸 Kotlin 鐨勯敊銆傚湪 equals() 娌℃湁杩濆弽 Liskov 鍘熷垯鐨勬儏鍐典笅锛屾病鏈夊姙娉曚骇鐢熸纭殑鍩轰簬浠峰€肩殑鏁版嵁銆?/span>
杩欏氨鏄负浠€涔?Kotlin 涓嶅厑璁告暟鎹被缁ф壙鐨勫師鍥犮€?/span>
鎴戜笉鐭ラ亾浣犱负浠€涔堟彁鍑鸿繖涓棶棰樸€傚鏋滀綘闇€瑕佹洿澶嶆潅鐨勭被锛屼綘浠嶇劧鍙互鍒涘缓瀹冧滑骞舵墜鍔ㄧ淮鎶ゅ畠浠殑 equals銆乭ashCode 绛夋柟娉曘€傛暟鎹被浠呬粎鏄竴涓畝鍗曠敤渚嬬殑渚挎嵎鏂瑰紡锛屽浜庡緢澶氫汉鏉ヨ杩欏緢甯歌銆?/span>
鍏紑绫?/span>
浣滆€呭啀娆¢剻瑙嗕簡锛屽姝ゆ垜瀹炲湪鏃犺瘽鍙銆?/span>
闄″抄鐨勫涔犳洸绾?/span>
浣滆€呰涓哄涔?Kotlin 寰堥毦锛?浣嗘槸鎴戜釜浜哄苟涓嶈繖涔堣涓恒€?/span>
鏈€鍚庣殑鎯虫硶
浠庝綔鑰呭垪涓剧殑渚嬪瓙涓紝鎴戞劅瑙変粬鍙槸浜嗚В璇█鐨勮〃闈€?/span>
寰堥毦鎯宠薄浠栧姝ゆ湁鎶曞叆寰堝鏃堕棿銆?/span>
鏈€杩戠殑璇█鎺掕锛宩ava渚濈劧鎺掑湪绗竴锛屽湪璇█鎺掕姒滀笂锛孠oltin宸茶鐢╁埌10鍚嶄箣澶栵紒


鍓嶇嚎鎺ㄥ嚭瀛︿範浜ゆ祦缇や竴瀹氳澶囨敞锛?/span> 鐮旂┒/宸ヤ綔鏂瑰悜+鍦扮偣+瀛︽牎/鍏徃+鏄电О锛堝鐩爣妫€娴?涓婃捣+涓婁氦+鍙彲锛?/span> 锛屾牴鎹牸寮忓娉紝鍙洿蹇閫氳繃涓旈個璇疯繘缇?/span>

    鍐嶈锛孠otlin 锛佷綘濂? Java 锛?></p> 
       </ul> 
      </section> 
     </section> 
    </section> 
   </section> 
  </section> 
 </section><p class=鎵爜鍔犳垜寰俊杩涚兢锛屽唴鎺ㄥ拰鎶€鏈氦娴侊紝澶т浆浠浂璺濈



END


鍘嗗彶鎺ㄨ崘






鍐嶈锛孠otlin 锛佷綘濂? Java 锛? class=
鍐嶈锛孠otlin 锛佷綘濂? Java 锛?> 
                     </section> 
                     <section class=
鐐逛釜鍦ㄧ湅鍚?/span>

以上是关于鍐嶈锛孠otlin 锛佷綘濂? Java 锛?/h1>

的主要内容,如果未能解决你的问题,请参考以下文章

鏄殑锛佷竴绡囨枃绔犲氨鑳藉甫浣犵湅瀹孼ooKeeper锛?/h1>

xshell 瑙e喅鈥滄墍閫夌殑鐢ㄦ埛瀵嗛挜鏈湪杩滅▼涓绘満涓婃敞鍐屻€傝鍐嶈瘯涓€娆♀€滱WS EC2

鍒繖鐫€鎾掓鍎夸簡锛岄€佷綘涓€鏈€婂墠绔嚱鏁板紡鏀诲煄鎸囧崡銆嬪彲濂斤紵

杞彾鏉?涓庣淮鐝嶇兢宀涜鍐嶈 锛圥addleboard, say bye to BVI) 1120-1121

鈻舵垜浼欏憜锛佷笁涓搧鐗岀殑澶寸洈锛屽摢涓兘鎵涗綇鍘嬪姏娴嬭瘯