class AttrDemo{
private var attr1 : String = "";
protected var attr2 : String = "";
public var attr3 : String = "";
var varattr : String = "";
val valattr : String = "";
var attr = 1;
}
private var attr1 : String
get() = attr1.toString()
set(value) {
attr1 = value
}
protected var attr2 : String
get() {
//TODO GET
return attr2.toString()
}
set(value) {
attr2 = value
}
var attr4 : String = "" //一定要初始化 private set
interface mInterfaceDemo{
fun function1()
fun function2(){
}
}
class InterfaceDemoImpl : mInterfaceDemo{
override fun function1() {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
class GenericDemo<T>(t : T){
var value = t
}
val generic: GenericDemo<Int> = GenericDemo<Int>(1)
val generic = GenericDemo(1)
class Outer {
private val bar: Int = 1
class Nested {
fun foo() = 2
}
}
class Outer {
private val bar: Int = 1
inner class Inner {
fun foo() = bar
}
}
val demo = Outer().Inner().foo() //==1
mvp_button.setOnClickListener(object : View.OnClickListener{
override fun onClick(v: View?) {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
});
mvp_button.setOnClickListener {
startActivity(Intent(MainActivity@this,MVPActivity::class.java))
}
enum class Direction {
EAST,NORTH,SOUTH,WEST
}
enum class Color(val rgb: Int) {
RED(0xFF0000),
GREEN(0x00FF00),
BLUE(0x0000FF)
}
Direction.EAST
Direction.valueOf("EAST");
Direction.values()
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有