forked from cctanfujun/kotlin-web-site-cn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
1063 lines (740 loc) · 44.1 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<!--[if (IE 7)&!(IEMobile)]><html class="no-js ie ie7" lang="en"><![endif]-->
<!--[if (IE 8)&!(IEMobile)]><html class="no-js ie ie8" lang="en"><![endif]-->
<!--[if (IE 9)&!(IEMobile)]><html class="no-js ie ie9" lang="en"><![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"><!--<![endif]-->
<html>
<head>
<meta charset="utf-8">
<title>Kotlin</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<link rel="Shortcut Icon" href="/kotlin-web-site-cn/assets/images/favicon.ico" type="image/x-icon"/>
<link rel="apple-touch-icon" href="/kotlin-web-site-cn/assets/images/apple-touch-icon.png" />
<link rel="apple-touch-icon" sizes="72x72" href="/kotlin-web-site-cn/assets/images/apple-touch-icon-72x72.png" />
<link rel="apple-touch-icon" sizes="114x114" href="/kotlin-web-site-cn/assets/images/apple-touch-icon-114x114.png" />
<link rel="apple-touch-icon" sizes="144x144" href="/kotlin-web-site-cn/assets/images/apple-touch-icon-144x144.png" />
<link rel="stylesheet" href="/kotlin-web-site-cn/css/styles.css">
<!-- begin Convert Experiments code--><!--<script type="text/javascript">var _conv_host = (("https:" == document.location.protocol) ? "https://d9jmv9u00p0mv.cloudfront.net" : "http://cdn-1.convertexperiments.com");document.write(decodeURIComponent("%3Cscript src='" + _conv_host + "/js/10013947-10013329.js' type='text/javascript'%3E%3C/script%3E"));</script> --> <!-- end Convert Experiments code -->
<script src="/kotlin-web-site-cn/js/vendor/requirejs/require.js"></script>
<script src="/kotlin-web-site-cn/js/config/bootstrap.js"></script>
</head>
<body class="page_index">
<!-- Google Tag Manager -->
<noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-5P98"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-5P98');</script>
<!-- End Google Tag Manager -->
<!-- CrazyEgg -->
<script type="text/javascript">
setTimeout(function(){var a=document.createElement("script");
var b=document.getElementsByTagName("script")[0];
a.src=document.location.protocol+"//dnn506yrbagrg.cloudfront.net/pages/scripts/0013/6939.js?"+Math.floor(new Date().getTime()/3600000);
a.async=true;a.type="text/javascript";b.parentNode.insertBefore(a,b)}, 1);
</script>
<!-- End CrazyEgg -->
<div class="global-layout">
<header class="global-header">
<div class="global-header-panel">
<div class="g-layout">
<a class="global-header-logo" href="/kotlin-web-site-cn/">Kotlin</a>
<nav role="navigation" class="global-nav">
<a href="/kotlin-web-site-cn/docs/reference/"
class="nav-item "
>
学习
</a>
<a href="/kotlin-web-site-cn/contribute.html"
class="nav-item "
>
贡献
</a>
<a href="http://try.kotlinlang.org"
class="nav-item "
>
在线尝试
</a>
<div class="extra-nav social-links">
<a href="https://github.com/JetBrains/kotlin" class="link link-github" title="Source Code on GitHub" target="_blank">
<i class="link-icon icon-github"></i>
</a>
<a href="https://twitter.com/project_kotlin" class="link link-twitter" title="Kotlin on Twitter" target="_blank">
<i class="link-icon icon-twitter"></i>
</a>
<a href="community.html" class="link link-forum" title="Kotlin Forum">
<i class="link-icon icon-forum"></i>
</a>
</div>
</nav>
</div>
</div>
<div class="g-layout">
<div class="kotlin-info">
<div class="kotlin-info-description">
针对JVM, Android和浏览器的静态编程语言!
</div>
<div class="kotlin-info-description-extra">
100%与Java™兼容
</div>
<a href="/kotlin-web-site-cn/#get-kotlin" class="get-kotlin-button">
尝试Kotlin
</a>
</div>
</div>
</header>
<section class="kotlin-overview-section _features">
<h2 class="section-header">为什么使用Kotlin?</h2>
<div class="section-content">
<div class="kotlin-features-carousel-wrap" id="features-carousel-wrap">
<div class="kotlin-features-carousel js-carousel">
<ul class="kotlin-features-list js-carousel-list">
<li class="kotlin-feature _concise js-popup-open-button"
data-popup-id="kotlin-feature_concise">
<div class="feature-image"><div class="feature-icon _concise"></div></div>
<h3 class="feature-title">Concise</h3>
<p class="feature-description">Drastically reduce the amount of boilerplate code you need to write.</p>
<span class="feature-example-link">See example</span>
</li>
<li class="kotlin-feature _safe js-popup-open-button"
data-popup-id="kotlin-feature_safe">
<div class="feature-image"><div class="feature-icon _safe"></div></div>
<h3 class="feature-title">Safe</h3>
<p class="feature-description">Avoid entire classes of errors such as null pointer exceptions.</p>
<span class="feature-example-link">See example</span>
</li>
<li class="kotlin-feature _versatile js-popup-open-button"
data-popup-id="kotlin-feature_versatile">
<div class="feature-image"><div class="feature-icon _versatile"></div></div>
<h3 class="feature-title">Versatile</h3>
<p class="feature-description">Build server-side applications, Android apps or frontend code running in the browser.</p>
<span class="feature-example-link">See example</span>
</li>
<li class="kotlin-feature _interoperable js-popup-open-button"
data-popup-id="kotlin-feature_interoperable">
<div class="feature-image"><div class="feature-icon _interoperable"></div></div>
<h3 class="feature-title">Interoperable</h3>
<p class="feature-description">Leverage existing frameworks and libraries of the JVM with 100% Java Interoperability.</p>
<span class="feature-example-link">See example</span>
</li>
<li class="kotlin-feature _tooling js-popup-open-button"
data-popup-id="kotlin-feature_tooling">
<div class="feature-image"><div class="feature-icon _tooling"></div></div>
<h3 class="feature-title">Tooling</h3>
<p class="feature-description">Command Line Compiler or First Class IDE Support. Freedom to choose.</p>
<span class="feature-example-link">See example</span>
</li>
</ul>
</div>
<div class="kotlin-features-carousel-nav _prev js-carousel-nav-prev is_disabled"></div>
<div class="kotlin-features-carousel-nav _next js-carousel-nav-next"></div>
</div>
</div>
<div class="overview-popup overview-popup_concise _hidden js-popup"
id="kotlin-feature_concise">
<div class="popup-content">
<h3 id="section">简洁<a href="#section" class="anchor"></a></h3>
<p>用一行代码创建一个 POJO 同时具有 getters, setters, <code>equals()</code>, <code>hashCode()</code>, <code>toString()</code> 和 <code>copy()</code> 方法:</p>
<pre><code class="code-block _highlighted lang_kotlin"><span class="n">data</span> <span class="k">class</span> <span class="nc">Customer</span><span class="p">(</span><span class="k">val</span> <span class="py">name</span><span class="p">:</span> <span class="n">String</span><span class="p">,</span> <span class="k">val</span> <span class="py">email</span><span class="p">:</span> <span class="n">String</span><span class="p">,</span> <span class="k">val</span> <span class="py">company</span><span class="p">:</span> <span class="n">String</span><span class="p">)</span></code></pre>
<p>或者使用lambda表达式过滤一个list:</p>
<pre><code class="code-block _highlighted lang_kotlin"><span class="k">val</span> <span class="py">positiveNumbers</span> <span class="p">=</span> <span class="n">list</span><span class="p">.</span><span class="n">filter</span> <span class="p">{</span><span class="n">it</span> <span class="p">></span> <span class="m">0</span><span class="p">}</span></code></pre>
<p>想要一个单例? 创建一个 object 吧:</p>
<pre><code class="code-block _highlighted lang_kotlin"><span class="k">object</span> <span class="nc">ThisIsASingleton</span> <span class="p">{</span>
<span class="k">val</span> <span class="py">companyName</span><span class="p">:</span> <span class="n">String</span> <span class="p">=</span> <span class="s">"JetBrains"</span>
<span class="p">}</span></code></pre>
</div>
<div class="popup-close-button js-popup-close-button"
data-popup-id="kotlin-feature_concise"></div>
</div>
<div class="overview-popup-overlay"></div>
<div class="overview-popup overview-popup_safe _hidden js-popup"
id="kotlin-feature_safe">
<div class="popup-content">
<h3 id="section">安全<a href="#section" class="anchor"></a></h3>
<p>避免那些令人讨厌的空指针异常,你知道的,这可能酿成数十亿美元的损失</p>
<pre><code class="code-block _highlighted lang_kotlin"><span class="k">var</span> <span class="py">output</span> <span class="p">:</span> <span class="n">String</span>
<span class="n">output</span> <span class="p">=</span> <span class="k">null</span></code></pre>
<p>当然Kotlin让你避免那些错误通过使用nullable类型,
也包括Java的</p>
<pre><code class="code-block _highlighted lang_kotlin"><span class="n">println</span><span class="p">(</span><span class="n">output</span><span class="p">.</span><span class="n">length</span><span class="p">())</span></code></pre>
<p>在你进行类型检查的时候,如果类型匹配,那么编译器会帮你进行自动转换</p>
<pre><code class="code-block _highlighted lang_kotlin"><span class="k">fun</span> <span class="nf">calculateTotal</span><span class="p">(</span><span class="n">obj</span><span class="p">:</span> <span class="n">Any</span><span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="n">obj</span> <span class="k">is</span> <span class="n">Invoice</span><span class="p">)</span> <span class="p">{</span>
<span class="n">obj</span><span class="p">.</span><span class="n">calculateTotal</span><span class="p">()</span>
<span class="p">}</span>
<span class="p">}</span></code></pre>
</div>
<div class="popup-close-button js-popup-close-button"
data-popup-id="kotlin-feature_safe"></div>
</div>
<div class="overview-popup-overlay"></div>
<div class="overview-popup overview-popup_versatile _hidden js-popup"
id="kotlin-feature_versatile">
<div class="popup-content">
<h3>Versatile</h3>
<p>Multi-purpose language allowing you to build any type of application</p>
<div class="logos-list">
<p class="logos-list-item">
<span class="logo _android" title="Android"></span>
<span class="description">
Android Development.<br>
No performance impact.<br>
Very small runtime.
</span>
</p>
<p class="logos-list-item">
<span class="logo _tomcat" title="Tomcat"></span>
<span class="description">
Application Server.<br>
The technology doesn't matter. 100% compatible with all JVM frameworks.
</span>
</p>
<p class="logos-list-item">
<span class="logo _js" title="JavaScript"></span>
<span class="description">
JavaScript. Write code in Kotlin and target JavaScript to run on Node.js or in browser
</span>
</p>
<p class="logos-list-item">
<span class="logo _javaee" title="JavaEE"></span>
<span class="description">
Enterprise. Use Kotlin for any type of Enterprise Java EE development.
</span>
</p>
<p class="logos-list-item">
<span class="logo _html5" title="HTML5"></span>
<span class="description">
Web. Whether you want strongly typed HTML, CSS builders or just plain web development.
</span>
</p>
</div>
</div>
<div class="popup-close-button js-popup-close-button"
data-popup-id="kotlin-feature_versatile"></div>
</div>
<div class="overview-popup-overlay"></div>
<div class="overview-popup overview-popup_interoperable _hidden js-popup"
id="kotlin-feature_interoperable">
<div class="popup-content">
<h3 id="interoperable">Interoperable<a href="#interoperable" class="anchor"></a></h3>
<p>Create and consume Java code at will</p>
<pre><code class="code-block _highlighted lang_kotlin"><span class="k">import</span> <span class="nn">io.netty.channel.ChannelInboundMessageHandlerAdapter</span>
<span class="k">import</span> <span class="nn">io.netty.channel.ChannelHandlerContext</span>
<span class="k">public</span> <span class="k">class</span> <span class="nc">NettyHandler</span><span class="p">:</span> <span class="n">ChannelInboundMessageHandlerAdapter</span><span class="p"><</span><span class="n">Any</span><span class="p">>()</span> <span class="p">{</span>
<span class="k">public</span> <span class="k">override</span> <span class="k">fun</span> <span class="nf">messageReceived</span><span class="p">(</span><span class="n">p0</span><span class="p">:</span> <span class="n">ChannelHandlerContext</span><span class="p">?,</span> <span class="n">p1</span><span class="p">:</span> <span class="n">Any</span><span class="p">?)</span> <span class="p">{</span>
<span class="k">throw</span> <span class="n">UnsupportedOperationException</span><span class="p">()</span>
<span class="p">}</span>
<span class="p">}</span></code></pre>
<p>Or use any existing library on the JVM, as there’s 100% compatibility, including SAM support.</p>
<p>Target either the JVM or JavaScript. Write code in Kotlin and decide where you want to deploy to</p>
<pre><code class="code-block _highlighted lang_kotlin"><span class="k">import</span> <span class="nn">js.dom.html.*</span>
<span class="k">fun</span> <span class="nf">onLoad</span><span class="p">()</span> <span class="p">{</span>
<span class="n">window</span><span class="p">.</span><span class="n">document</span><span class="p">.</span><span class="n">body</span><span class="p">.</span><span class="n">innerHTML</span> <span class="p">+=</span> <span class="s">"<br/>Hello, Kotlin!"</span>
<span class="p">}</span></code></pre>
</div>
<div class="popup-close-button js-popup-close-button"
data-popup-id="kotlin-feature_interoperable"></div>
</div>
<div class="overview-popup-overlay"></div>
<div class="overview-popup overview-popup_tooling _hidden js-popup"
id="kotlin-feature_tooling">
<div class="popup-content">
<h3 id="tooling">Tooling<a href="#tooling" class="anchor"></a></h3>
<p>A language needs tooling and at JetBrains, it’s what we do best!</p>
<p class="image-block"><img src="assets/images/index/features/tooling/tooling1.png" alt="Tooling" /></p>
<p class="image-block"><img src="assets/images/index/features/tooling/tooling2.png" alt="Tooling" /></p>
</div>
<div class="popup-close-button js-popup-close-button"
data-popup-id="kotlin-feature_tooling"></div>
</div>
<div class="overview-popup-overlay"></div>
</section>
<section class="kotlin-overview-section _code-examples">
<div class="kotlin-overview-code-example-tabs">
<div class="g-layout">
<div class="tab is_active js-tab" data-tab-id="kotlin-code-example-simplest"><div class="text">Simplest Version</div></div>
<div class="tab js-tab" data-tab-id="kotlin-code-example-name-reading"><div class="tab-text">Name Reading</div></div>
<div class="tab js-tab" data-tab-id="kotlin-code-example-object-oriented"><div class="tab-text">An “Object-oriented” Hello</div></div>
</div>
</div>
<h2 class="section-header">What does it look like?</h2>
<p class="section-description">Concise, simple and very easy to read (and write)</p>
<div class="section-content">
<!-- code example -->
<div class="kotlin-overview-code-example" id="kotlin-code-example-simplest">
<div class="code-line">
<div class="code"><span class="keyword">package</span> hello
</div>
<div class="code-legend align_right">
<div class="code-legend-line"></div>
<div class="code-legend-text">
Optional package header
</div>
</div>
</div>
<div class="code-line">
<div class="code"><span class="keyword">fun</span> <span class="func-name">main</span>(<span class="var-name">args</span>: Array<String>) {</div>
<div class="code-legend align_right">
<div class="code-legend-line"></div>
<div class="code-legend-text">
Package-level function, which returns Unit and takes an Array
of strings as a parameter
</div>
</div>
</div>
<div class="code-line">
<div class="code"> <span class="buildin-func-name">println</span>(<span class="string-literal">"Hello World!"</span>)
}
</div>
<div class="code-legend align_right">
<div class="code-legend-line-marker"></div>
<div class="code-legend-line" style="
-webkit-transform: rotate(29deg);
-ms-transform: rotate(29deg);
transform: rotate(29deg);
top: 70px;
left: 23px;
right: -12px;
"></div>
<div class="code-legend-text" style="top: 100px;">
Have you noticed?<br> Semicolons are optional
</div>
</div>
</div>
</div>
<!--/ code example -->
<!-- code example -->
<div class="kotlin-overview-code-example is_hidden" id="kotlin-code-example-name-reading">
<div class="code-line"><div class="code"><span class="keyword">fun</span> <span class="func-name">main</span>(<span class="var-name">args</span>: Array<String>) {
<span class="keyword">if</span> (<span class="var-name">args</span>.size() == <span class="number">0</span>) {
println(<span class="string-literal">"Provide a name"</span>)
<span class="keyword">return</span>
}</div></div>
<div class="code-line">
<div class="code"> println(<span class="string-literal">"Hello, <span class="string-literal-var-substitution">${</span><span class="var-name">args</span><span class="generic-code">[</span><span class="number">0</span><span class="generic-code">]<span class="string-literal-var-substitution">}</span></span><span class="string-literal-var-substitution"></span>!"</span>)
</div>
<div class="code-legend align_right">
<div class="code-legend-line"></div>
<div class="code-legend-text">
String Interpolation to cut down ceremony.
</div>
</div>
</div>
<div class="code-line">
<div class="code">}</div>
</div>
</div>
<!--/ code example -->
<!-- code example -->
<div class="kotlin-overview-code-example is_hidden" id="kotlin-code-example-object-oriented" style="left: 50px; max-width: 700px;">
<div class="code-line">
<div class="code"><span class="keyword">class</span> <span class="class-name">Greeter</span>(<span class="keyword">val</span> <span class="var-name">name</span>: String) {</div>
<div class="code-legend align_left">
<div class="code-legend-line"></div>
<div class="code-legend-text">
Class with a primary constructor and a member function
</div>
</div>
</div>
<div class="code-line">
<div class="code"> <span class="keyword">fun</span> <span class="func-name">greet</span>() {
<span class="buildin-func-name">println</span>(<span class="string-literal">"Hello, <span class="string-literal-var-substitution">$<span class="var-name">name</span></span>"</span>)
}
}
</div>
</div>
<div class="code-line">
<div class="code"><span class="keyword">fun</span> <span class="func-name">main</span>(<span class="var-name">args</span>: Array<String>) {
<span class="class-name"> Greeter</span>(<span class="var-name">args</span>[<span class="number">0</span>]).greet()</div>
</div>
<div class="code-line">
<div class="code">} </div>
<div class="code-legend align_right">
<div class="code-legend-line">
<div style="
position: absolute;
width: 1px;
background: #fff;
bottom: 1px;
height: 17px;
"></div>
</div>
<div class="code-legend-text">
Note that there's no new keyword
used to create an object
</div>
</div>
</div>
<div class="code-line">
<div class="code">
</div>
</div>
</div>
<!--/ code example -->
<div class="more-link-wrap">
<a href="/kotlin-web-site-cn/docs/reference/" class="more-link">More examples in the full language documentation</a>
</div>
</div>
</section>
<section class="kotlin-overview-section _video-overview">
<div class="section-content">
<div class="video-player-wrap js-video-player-wrap">
<a href="http://www.youtube.com/watch?v=viiDaLpPfN4" class="video-thumb-link js-video-thumb-link">
<span class="video-description">
<span class="title">See Kotlin in action</span>
<span class="description"></span>
</span>
<span class="video-player-play-button js-play-video-button"></span>
<span class="video-thumb-cover"></span>
<img src="/kotlin-web-site-cn/assets/images/index/how-to-use-kotlin-video-thumb.jpg"
class="video-thumb"
alt="Getting Started with Kotlin in 2 minutes"
height="506"
>
</a>
<div class="js-video-player">
</div>
</div>
</div>
</section>
<section class="kotlin-overview-section _get-kotlin" id="get-kotlin">
<h2 class="section-header">Try Kotlin</h2>
<p class="kotlin-version">0.12.613</p>
<div class="section-content">
<div class="get-kotlin-options-list">
<div class="option-item _standalone-compiler">
<div class="option-image _standalone-compiler"></div>
<div class="option-title-pre-text">Standalone</div>
<h3 class="option-title">Compiler</h3>
<p class="option-description">
Compile your code from the command line or use build tools such as Ant, Gradle and Maven.
</p>
<div class="option-link-wrap">
<a href="/kotlin-web-site-cn/docs/tutorials/command-line.html"
class="option-link">Download Compiler</a>
</div>
</div>
<div class="option-item _intellij-idea">
<div class="option-image _intellij-idea"></div>
<div class="option-title-pre-text">Use</div>
<h3 class="option-title">IntelliJ IDEA</h3>
<p class="option-description">
Kotlin works with the free Community Edition, IntelliJ IDEA Ultimate or Android Studio.
</p>
<div class="option-link-wrap">
<a href="/kotlin-web-site-cn/docs/tutorials/getting-started.html"
class="option-link">
Setup Plugin
</a>
</div>
</div>
<div class="option-item _source-code">
<div class="option-image _source-code"></div>
<div class="option-title-pre-text">Use</div>
<h3 class="option-title">Eclipse</h3>
<p class="option-description">
Get a preview version of the Kotlin plugin for Eclipse Luna.
</p>
<div class="option-link-wrap">
<a href="/kotlin-web-site-cn/docs/tutorials/getting-started-eclipse.html"
class="option-link">
Setup Plugin
</a>
</div>
</div>
<div class="option-item _try-online">
<div class="option-image _try-online"></div>
<div class="option-title-pre-text">In the browser</div>
<h3 class="option-title">Try Online</h3>
<p class="option-description">
Explore Kotlin code samples and solve problems directly in your browser.
</p>
<div class="option-link-wrap">
<a href="http://try.kotlinlang.org"
class="option-link">
Try Online
</a>
</div>
</div>
</div>
<div class="overview-popup _hidden js-popup"
id="setting-up-idea-option-popup">
<div class="popup-content">
<h3>Setting Up IntelliJ IDEA</h3>
<h4>Milestone Versions</h4>
<p>
A stable milestone version of Kotlin can be obtained from JetBrains <a href="#">Plugin Repository</a>.
<br>
In IDEA navigate to: Settings -> Plugins -> Browse Repositories
<br>
Select the Kotlin plugin and then Download and Install.
</p>
<h4>Using the Kotlin Nightly Builds</h4>
<p>In IDEA navigate to: Preferences -> Plugins -> Browse Repositories. Enter:</p>
<ul>
<li>
for IntelliJ IDEA 13 EAP:<br>
<small>http://teamcity.jetbrains.com/guestAuth/repository/download/bt345/.lastSuccessful/updatePlugins.xml</small>
</li>
<li>
for IntelliJ IDEA 12.1.5: <br>
<small>http://teamcity.jetbrains.com/guestAuth/repository/download/bt345/.lastSuccessful/updatePlugins.xml?branch=idea12</small>
</li>
<li>
for IntelliJ IDEA 12.1.4 and below: download manually, see instructions below.
</li>
</ul>
<p>Then you should be able to select the Kotlin plugin and Download and Install. The repository above contains nightly builds published automatically.</p>
</div>
<div class="popup-close-button js-popup-close-button"
data-popup-id="setting-up-idea-option-popup"></div>
</div>
</div>
</section>
<section class="kotlin-overview-section _testimonials">
<div class="section-header">Who's using Kotlin</div>
<div class="section-content">
<div class="g-layout2 testimonials-carousel-wrap" id="testimonials-carousel-wrap">
<div class="testimonials-carousel js-carousel">
<ul class="testimonials-list js-carousel-list">
<li class="testimonials-list-item">
<blockquote class="testimonial-quote">
<div class="text">IntelliJ IDEA plugins, YouTrack vNext, CRM apps, new products etc.</div>
</blockquote>
<div class="testimonial-company">
<a href="http://www.jetbrains.com/"
class="testimonial-company-link"
target="_blank"
rel="nofollow">
JetBrains
</a>
</div>
</li>
<li class="testimonials-list-item">
<blockquote class="testimonial-quote">
<div class="text">Using Kotlin for the Front-End Web</div>
</blockquote>
<div class="testimonial-company">
<a href="http://hive.geosystems.aero/?locale=en"
class="testimonial-company-link"
target="_blank"
rel="nofollow">
Industrial Geodetic Systems
</a>
</div>
</li>
<li class="testimonials-list-item">
<blockquote class="testimonial-quote">
<div class="text">Kotlin in backend, data processing and service development</div>
</blockquote>
<div class="testimonial-company">
<a href="http://prezi.com"
class="testimonial-company-link"
target="_blank"
rel="nofollow">
Prezi.com
</a>
</div>
</li>
<li class="testimonials-list-item">
<blockquote class="testimonial-quote">
<div class="text">Using Kotlin in data processing pipeline, ElasticSearch plugins, and IDE plugins</div>
</blockquote>
<div class="testimonial-company">
<a href="http://linkedin.com/company/bremeld"
class="testimonial-company-link"
target="_blank"
rel="nofollow">
Bremeld Corp SA
</a>
</div>
</li>
<li class="testimonials-list-item">
<blockquote class="testimonial-quote">
<div class="text">Medication Control - Android Application</div>
</blockquote>
<div class="testimonial-company">
<a href="https://play.google.com/store/apps/details?id=ru.evilbloodydemon.pills"
class="testimonial-company-link"
target="_blank"
rel="nofollow">
Igor Fomin
</a>
</div>
</li>
<li class="testimonials-list-item">
<blockquote class="testimonial-quote">
<div class="text">Data schema compiler for TL language implemented in Kotlin</div>
</blockquote>
<div class="testimonial-company">
<a href="https://github.com/ex3ndr/telegram-tl"
class="testimonial-company-link"
target="_blank"
rel="nofollow">
Telegram
</a>
</div>
</li>
<li class="testimonials-list-item">
<blockquote class="testimonial-quote">
<div class="text">Facebook Game with over 10K users daily. Written in Java and all new code in Kotlin</div>
</blockquote>
<div class="testimonial-company">
<a href="https://www.facebook.com/wrestler.unstoppable"
class="testimonial-company-link"
target="_blank"
rel="nofollow">
Wrestler.Unstoppable
</a>
</div>
</li>
<li class="testimonials-list-item">
<blockquote class="testimonial-quote">
<div class="text">Android Application used internally</div>
</blockquote>
<div class="testimonial-company">
Plastoria
</div>
</li>
<li class="testimonials-list-item">
<blockquote class="testimonial-quote">
<div class="text">Android Application. Using Kotlin since M2</div>
</blockquote>
<div class="testimonial-company">
<a href="http://duofm.bitbucket.org"
class="testimonial-company-link"
target="_blank"
rel="nofollow">
Uncopt LLC
</a>
</div>
</li>
<li class="testimonials-list-item">
<blockquote class="testimonial-quote">
<div class="text">Using Kotlin to build a new Vertical Product with team of five</div>
</blockquote>
<div class="testimonial-company">
<a href="http://gmc.net"
class="testimonial-company-link"
target="_blank"
rel="nofollow">
GMC
</a>
</div>
</li>
<li class="testimonials-list-item">
<blockquote class="testimonial-quote">
<div class="text">True Fool. A Durak card game for Android written in Kotlin and libGDX</div>
</blockquote>
<div class="testimonial-company">
<a href="https://play.google.com/store/apps/details?id=truefool.android"
class="testimonial-company-link"
target="_blank"
rel="nofollow">
JackOfHearts
</a>
</div>
</li>
<li class="testimonials-list-item">
<blockquote class="testimonial-quote">
<div class="text">Android news application with 99% code written in Kotlin</div>
</blockquote>
<div class="testimonial-company">
Schibsted Tech Polska
</div>
</li>
<li class="testimonials-list-item">
<blockquote class="testimonial-quote">
<div class="text">Most new non-UI code written in Kotlin</div>
</blockquote>
<div class="testimonial-company">
<a href="https://play.google.com/store/apps/details?id=com.levelmoney.mobile"
class="testimonial-company-link"
target="_blank"
rel="nofollow">
Level Money
</a>
</div>
</li>
<li class="testimonials-list-item">
<blockquote class="testimonial-quote">
<div class="text">Fuzzy app/contact search and new UI written in Kotlin</div>
</blockquote>
<div class="testimonial-company">
<a href="https://play.google.com/store/apps/details?id=name.pilgr.appdialer"
class="testimonial-company-link"
target="_blank"
rel="nofollow">
AppDialer
</a>
</div>
</li>
<li class="testimonials-list-item">
<blockquote class="testimonial-quote">
<div class="text">Android app for searching bus trips with new features written in Kotlin since M9</div>
</blockquote>
<div class="testimonial-company">
<a href="https://play.google.com/store/apps/details?id=de.raumobil.android.busliniensuche"
class="testimonial-company-link"
target="_blank"
rel="nofollow">
Busradar (Busliniensuche)
</a>
</div>
</li>
</ul>
</div>
<div class="testimonials-carousel-nav _prev js-carousel-nav-prev is_disabled"></div>
<div class="testimonials-carousel-nav _next js-carousel-nav-next"></div>