【发布时间】:2013-06-15 19:55:30
【问题描述】:
我一直在关注互联网上关于 SQLite 的 android 教程。我有一个我不确定的声明:
public HotOrNot open(){
ourHelper = new DbHelper(ourContext);
ourDatabase = ourHelper.getWritableDatabase();
return this;
}
return this 在这个方法中是什么意思?它是当前对象还是上下文?谢谢
【问题讨论】:
-
调用此方法的
HotOrNot的当前实例。 -
... the keyword this denotes a value that is a reference to the object for which the instance method was invoked.JLS 15.8.3 -
也就是说,当在对象上调用方法(函数)时,this指的是调用当前方法的对象。
标签: java android methods return