Home > Back-end >  About the type of Java and c # contrast understanding confusion
About the type of Java and c # contrast understanding confusion

Time:10-13

Basic data types to Java, my understanding is that the basic data types are value types, have nothing to do with Object class, and other types in Java, namely reference types are integrated from the Object class, for c #, a reference type is inherited from the Object class, and basic data types (value type) as if also is inherited from Object class (namely system. Object), since they are a subclass of Object class, then what is the split open a case using the put down what? Or I understand there is an error, the problem about for a long time, ask the great spirit guide!

CodePudding user response:

C # more pure point (really did everything is an Object), no primitive types in Java, c # is the difference between the values in the type of reference type attribute values are based on the test case, c # in the packing is all variables are converted into the Object to operate, split open a case is converted into a specific type, the original type is not the Object in the Java, Java boxing is the original type of encapsulation corresponding reference type, split open a case is to extract value corresponding to the original type in reference types,

CodePudding user response:

Packing: basic types into a wrapper types of process, Object a=1;
Split open a case: a wrapper type transformation as the basic types of process, Interger. Vauleof (a);

  • Related