调用警告
Person.class
public class Person {private String name;Person(String name) {this.name = name.trim();}public String getName() {return name;}public void setName(String name) {this.name = name;}public String getFullName() {return name + " Wang";}
}
main.kt
fun main() {var person=Person("John")println(person.getFullName())}
解决:
getXXX()的java方法,kotlin调用时,把其当成一个类的一个属性XXX,直接用点获取
println(person.fullName)