August 29, 2014
Reference books: book1: deep dive into Java virtual machines
Error in book1:
P191 indicates that only variables modified by the static keyword can use constantvalue,
I wrote code for javap decompilation,
In the source code: Final Int = 1;
Constantvalue appears in the bytecode
As described in the preface, I sent an email but did not respond ......
This book is really good.
Field table:
The structure is the same as that of the method table. For details, refer to my description of the method table.
This section is also listed separately because a special attribute constanvalue may exist in the field table.
1. When will this attribute be available ?????
(1). Final field (the field type is basic type and string type)
(2). Specify a value during definition.
(3) The Compiler recognizes this value.
2. Why does the static compiler constant in accessing a class not cause initialization of this class ?????
Refer to the preparation stage in "loading of classes.
This article from the "thick and thin hair" blog, please be sure to keep this source http://duanzhenyue.blog.51cto.com/9360091/1550126
Constantvalue of the field table