package MyStringExtensionsfun String.lastChar(): Char = get(length - 1)»> println("Kotlin".lastChar()) 利用函数扩展，Kotlin也支持运算符重载：// overloading '+' operator using an extension methodoperator fun Point.plus(other: Point): Point {»> val p1 = Point(10,