java - 为 GsmCellLocation 类接口返回的 toString 是什么?
问题描述
我试图弄清楚当我调用这个函数 toString() 时返回的是什么。在文档中它说“类 {@code Object} 的 {@code toString} 方法返回一个字符串,该字符串由对象是实例的类的名称、符号字符‘{@code @}’组成,以及对象的哈希码的无符号十六进制表示。返回值如下所示:[22036,36138303,0]
我将包含用于调用函数 to.String() 的代码。我知道 GsmCellLocation 已被弃用,我只是想了解这 3 个数字是什么。一旦我弄清楚这一点,我希望更新到 CellIdentityGsm,谢谢你的帮助。
@TargetApi(Build.VERSION_CODES.GINGERBREAD)
@Override
public void onCellLocationChanged(CellLocation cellLocation) {
super.onCellLocationChanged(cellLocation);
if(cellLocation == null) return;
Log.i(LOG_TAG, "onCellLocationChanged");
String desc = "\"" + cellLocation.getClass().getSimpleName() + "\" : " + cellLocation.toString();
textView.setText("Cell Info Logger\nCell Location\n"+desc);
logger.write(desc);
} // END onCellLocationChanged
这是它的文档:
/**
* Returns a string representation of the object. In general, the
* {@code toString} method returns a string that
* "textually represents" this object. The result should
* be a concise but informative representation that is easy for a
* person to read.
* It is recommended that all subclasses override this method.
* <p>
* The {@code toString} method for class {@code Object}
* returns a string consisting of the name of the class of which the
* object is an instance, the at-sign character `{@code @}', and
* the unsigned hexadecimal representation of the hash code of the
* object. In other words, this method returns a string equal to the
* value of:
* <blockquote>
* <pre>
* getClass().getName() + '@' + Integer.toHexString(hashCode())
* </pre></blockquote>
*
* @return a string representation of the object.
*/
public String toString() {
return getClass().getName() + "@" + Integer.toHexString(hashCode());
}
解决方案
推荐阅读
- python - 尝试使用 PySide2 显示网络摄像头时没有可用的取景器
- css - 锚标记 CSS 样式不适用
- php - Lavarel - 嵌套查询条件
- python - Python使用行索引作为numpy数组中方程的变量输入
- python - 即使文件在 Windows 10 上不存在,os.path.exists 也会返回 True
- javascript - Javascript:柯里化函数参数而不设置其函数上下文
- kubernetes - Migrating ROM, RWO persistent volume claims from in-tree plugin to csi in GKE
- javascript - 如何使用按钮来操作值
- ios - 如何阻止 UITableview 一次滚动多个单元格
- javascript - 我的复选框星级评分不起作用