1. Read the example carefully: Enumtest.java, run it, analyze the running results? What conclusions can you get? Have you mastered the basic usage of enum types?
public class Enumtest {public static void Main (string[] args) { Size s=size.small; Size T=size.large; S and T refer to the same object? System.out.println (s==t); //is the original data type? System.out.println (S.getclass (). isprimitive ());//Determine whether the data for the class package is converted from string to Size u=size.valueof ("SMALL") ; System.out.println (s==u); True //lists all its values for (Size value:Size.values ()) { System.out.println (value);} } }
The first one determines if s and T refer to the same object, the second determines whether it is a class-wrapped data, the third T determines whether s is equal to u, lists all the elements inside it, so the enumeration type is a reference type, the enumeration is not of the original data type, and each of its specific values refers to a specific object that can be used The value of the directly-compared enumeration variable.
2. Read the corresponding textbook, or use the Internet search engine to find out the concepts of anti-code, complement and original code
The original code is the absolute value of the symbol bit plus the truth, that is, the first digit to represent the symbol, the remaining bits represent the values,
The complement of the expression method is: a positive complement is its own negative complement is in its original code on the basis of the symbol bit unchanged, the rest of you take the counter, the last +1. (That is, on the basis of the anti-code +1)
The inverse code is represented by: the inverse of a positive number is its own negative anti-code is in its original code based on the symbol bit unchanged, the remaining bits are reversed.
3.Java variables follow the "shielding principle of variable with the same name", please read the relevant information after class to clarify the relevant knowledge.
In the code, the first value is a member variable, is also a global variable, the second value is a local variable, the local variable can overwrite the global variable, when the local use of a variable, the JVM will first find and the current position near the definition of the variable.
Java hands-on brain