hello Kotlin

Eclipse + Kotlin 插件开发Kotlin


1.下载Eclipse 

本文使用Eclipse Committers   版本 Mars.1 Release (4.5.1)  ,下载链接 http://www.eclipse.org/downloads/    


2.安装Kotlin插件 

   (不需要  番羽  土蔷 )   eclipse--help--Eclipse Marketplace

hello Kotlin_第1张图片



3.安装完后重启Eclipse

4.新建Kotlin工程

File--New--Project    输入工程名,finish。 创建完Kotlin工程后Eclipse显示的是java工程的标志

hello Kotlin_第2张图片


hello Kotlin_第3张图片


5.创建Class文件

File--New--Other    选择Kotlin Class  ,输入类名 包名  完成

hello Kotlin_第4张图片


hello Kotlin_第5张图片




创建完成后工程结构

hello Kotlin_第6张图片


6.编写Hello world  ,点击Eclispe绿色运行按钮即可运行

package com.kotlin.test


fun main(args:Array<String>){
	println("hello world");	
	
	println(sum(1,2));
	
	println(hello("Kotlin"))
	
	println("""hello K
	o
	t
	l
	i
	n""")
	
	
}

fun hello(who:String):String="hello,"+who;

fun sum(a: Int, b: Int): Int {
	return a + b
}


输出如下:

hello world
3
hello,Kotlin
hello K
	o
	t
	l
	i
	n

代码截屏

hello Kotlin_第7张图片


你可能感兴趣的:(eclipse,world,hello,Kotlin)