上一页 1 ··· 173 174 175 176 177 178 179 180 181 ··· 494 下一页
摘要: //vararg: just like ...args in js class Stack<T>(vararg val items: T) { val elements = items.toMutableList() fun push(element: T) { elements.add(eleme 阅读全文
posted @ 2020-10-14 02:46 Zhentiw 阅读(98) 评论(0) 推荐(0)
摘要: //vararg: just like ...args in js class Stack<T>(vararg val items: T) { val elements = items.toMutableList() fun push(element: T) { elements.add(eleme 阅读全文
posted @ 2020-10-14 02:40 Zhentiw 阅读(50) 评论(0) 推荐(0)
摘要: In this lesson, we create a face for a head using layered comma-separated background images. CSS allows us to layer as many background images as we wa 阅读全文
posted @ 2020-10-14 02:21 Zhentiw 阅读(83) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2020-10-14 01:54 Zhentiw 阅读(80) 评论(0) 推荐(0)
摘要: private protected internal: accessable for the project / module public https://kotlinlang.org/docs/reference/visibility-modifiers.html 阅读全文
posted @ 2020-10-13 02:33 Zhentiw 阅读(70) 评论(0) 推荐(0)
摘要: import java.util.* class Animal { var age = 0 get() = field set(value) { if(value >= 0) { field = value } else { throw Error("bad number") } } } fun m 阅读全文
posted @ 2020-10-13 02:27 Zhentiw 阅读(96) 评论(0) 推荐(0)
摘要: enum class Color { RED, GREEN, BLUE } fun main() { println(Color.GREEN) // GREEN } Or give enum a value: enum class Color { RED(0xFF0000), GREEN(0x00F 阅读全文
posted @ 2020-10-12 15:04 Zhentiw 阅读(89) 评论(0) 推荐(0)
摘要: Singleton Object need to be defined as global variable: object Cache { val name= "Cache" fun retrieveDate(): Int { return 0 } } fun main() { println(C 阅读全文
posted @ 2020-10-12 14:58 Zhentiw 阅读(95) 评论(0) 推荐(0)
摘要: If we want to use Class to represent a piece of data such as Object, we can use Data class instead of normal class. Difference: Data class has better 阅读全文
posted @ 2020-10-12 14:56 Zhentiw 阅读(171) 评论(0) 推荐(0)
摘要: interface Lendable { fun borrow() } // The properties title, genre, and publicationYear can be included in the parent class because both books and DVD 阅读全文
posted @ 2020-10-12 14:53 Zhentiw 阅读(97) 评论(0) 推荐(0)
上一页 1 ··· 173 174 175 176 177 178 179 180 181 ··· 494 下一页