有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!


共 (1) 个答案

  1. # 1 楼答案

    "foo".CharAt() How does charAt access the value of "foo"?

    charAt通过方法内的this引用访问值"foo"

    调用obj.method()时,可以将obj视为名为this的隐式参数。在Java 8中,您甚至可以在方法签名中显式显示它,如下所示:

    class SomeClass {
        public void someMethod(SomeClass this) {
            // ...
        }
    }
    

    这里有一个很好的起点:The Java™ Tutorials: Using the ^{} Keyword