var name: String = "jason" name = "jame" val max = 10
object Config {
const val TAG = "config"
}
class Config {
companion object {
const val TAG = "config"
}
}
fun log(msg: String): Unit {
println(msg)
}
fun square(x: Int) = x * x
fun main(args: ArrayList<String>) {
//
}
class Hello() {
//
}
fun divide(divisor: BigDecimal, scale: Int = 0): BigDecimal class Student2(val name: String, val registered: Boolean = false, credits: Int = 0)
fun deleteFiles(filePattern: String, recursive: Boolean, ignoreCase: Boolean,
deleteDirectories: Boolean): Unit
{
// do something
}
deleteFiles("*.jpg", true, true, false)
deleteFiles("*.jpg", recursive = true, ignoreCase = true, deleteDirectories = false)
fun prints(vararg strings: String) {
for (string in strings)
println(string)
}
prints("a", "b", "c")
val strings = arrayOf("a", "b", "c", "d", "e")
prints(*strings)
fun roots(k: Int): Pair<Double, Double> {
require(k >= 0)
val root = Math.sqrt(k.toDouble())
return Pair(root, -root)
}
val (pos, neg) = roots(16)
tailrec fun findFixPoint(x: Double = 1.0): Double = if (x == Math.cos(x)) x
else findFixPoint(Math.cos(x))
val printMessage = { message: String -> println(message) }
printMessage("hello")
printMessage("world")
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有