- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我有这个字节码:
new java.lang.Object
// stack is [newObjectRef]
dup
// Stack is [newObjectRef newObjectRef]
invokespecial void java.lang.Object.<init>()
// Stack is [initializedAsTypeObjectObjectRef]
putstatic java.lang.Object class.a
// variable a has the reference of new object
getstatic java.io.PrintStream java.lang.System.out
// Take the static value of System.out
// Stack is [initializedAsTypeObjectObjectRef System.out]
更新这是延续:
> ldc "test" // Stack is
> [initializedAsTypeObjectObjectRef System.out "test"]
> jsr pos.0000026C // call a subrutine invokevirtual void
> java.io.PrintStream.println(java.lang.String) // actually print the
> result // stack is (I think) Empty at this time ?
请问翻译是:
Object a = new Object();
a = "test";
System.out.print(a);
我的堆栈好吗?
我不确定是否能很好地理解 out()。可能我将不得不使用 out() setter 并在之后使用 print() ?
我总是习惯性地使用out()打印..
最佳答案
如果我编译代码
public static void main(String[] args) {
Object a;
a = "test";
System.out.println(a);
}
然后运行
javap -c Main
我明白了
public static void main(java.lang.String[]);
Code:
0: ldc #2 // String test
2: astore_1
3: getstatic #3 // Field java/lang/System.out:Ljava/io/PrintStream;
6: aload_1
7: invokevirtual #4 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
10: return
可以看到getstatic
加载字段System.out
对象没有名为 out()
的方法
,所以我不相信您正在查看您认为自己是的代码。
getstatic
获取一个 static
字段,例如System.out
是 System 的一个static
字段,所以如果你写
System.out.println();
这将导致使用 getstatic
关于java - getstatic 在字节码中的真正含义是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8546124/
这个问题在这里已经有了答案: Towards the "true" definition of JAVA_HOME (5 个答案) 关闭 4 年前。 为什么 ActiveMQ 提供者需要设置 JAV
这个问题在这里已经有了答案: What is a lambda expression in C++11? (10 个答案) 关闭 8 年前。 这是来自 boosts asio 的一个例子。这是什么意
这个问题在这里已经有了答案: What does the double colon (::) mean in CSS? (3 个答案) 关闭 7 年前。 我经常看到这种用法。特别是伪类。“::”在
嗨,另一个愚蠢的简单问题。我注意到在Apple框架中的某些typedef中使用符号"<<"谁能告诉我这是什么意思?: enum { UIViewAutoresizingNone
someObject.$() 是什么意思? 我正在浏览 sapui5 工具包中的 tilecontainer-dbg 文件,发现了这个: var oDomRef = this.$(); or some
这个问题已经有答案了: How to interpret function parameters in software and language documentation? (4 个回答) 已关闭
我遇到过这个语法。任何人都可以解释一下 getArg1ListInfo:()=>(object.freeze(arg1)) 的含义 function foo (arg1,arg2) { let
对于子类,我有以下代码: class child1 : public parent { public: static parent* function1(void) { ret
这个问题在这里已经有了答案: What does "|=" mean? (pipe equal operator) (6 个答案) 关闭 1 年前。 我有一部分代码包含以下功能: void Keyb
以下在 C++ 中是什么意思? typedef PComplex RComplex [100]; 请注意,PComplex 是我代码中的用户定义类型。 谢谢 最佳答案 RComplex 是 PComp
在我的 Lisp 代码中,我有函数 (nfa-regex-compile),它创建一个包含初始状态、转换和最终状态的 cons 列表(表示自动机的节点)从作为参数给出的正则表达式开始。 在这种情况下,
以下文字摘自 Learning Spark 第 3 章 One issue to watch out for when passing functions is inadvertently seria
PHP 文档 block 中以下内容的含义是什么: #@+ zend框架代码中的一个例子: /**#@+ * @const string Version constant numbers */ c
由于 python 的一些版本控制问题,我必须使用自定义函数来比较 HMAC (SHA512)。为此,我找到了这个函数: def compare_digest(x, y): if not (i
取自this answer here : static const qi::rule node = '{' >> *node >> '}' | +~qi::char_("{}"); 请注意,声明了名称
我正在查看 chi 包的文档。我看到类似的东西: https://github.com/pressly/chi/blob/master/_examples/rest/main.go#L154 data
我想知道如果我采用值为 8 的 INT,这是否意味着我只能从 1 到 99999999 或从 1 到 4294967295 UNSIGNED? 最佳答案 文档似乎很清楚这一点: Numeric Typ
我想知道如果我采用值为 8 的 INT,这是否意味着我只能从 1 到 99999999 或从 1 到 4294967295 UNSIGNED? 最佳答案 文档似乎很清楚这一点: Numeric Typ
这个问题在这里已经有了答案: 关闭9年前。 Possible Duplicate: Does “/* (non-javadoc)” have a well-understood meaning? 以下
在 Prolog 代码中,可以使用“ headless ”Horn 子句将指令传递给编译器,这些子句与指向左侧的物质蕴涵 ':-' (⇐) 的左侧没有头部关系。例如,导入模块或声明 Unit Test
我是一名优秀的程序员,十分优秀!