compilation error occurs.) (in jdk1.5 and above, B can be the base data type, a cannot)Similarly, other encapsulation classes and basic types are the same.The difference between equals and = = in Java= = compares the addresses of 2 objects, while equals compares the contents of 2 objects.In versions above jdk1.5, the base and wrapper classes can be converted automatically, similar to string-type objects and strings constants. Java code
Integer i1 = 123;
Integer i2 = 123;
int i = 12
unboxing process is implemented by invoking the wrapper's Xxxvalue method. (XXX represents the corresponding basic data type).Three. Questions related to the interviewWhile most people are clear about the concept of boxing and unpacking, the question of packing and unpacking in interviews and written tests does not necessarily answer. Here are some common questions related to packing/unpacking.1. What is the output of the following code?
123456789101112
publicclassMain {publics
layout. wxml as follows: add i3
3
The code for modifying layout. wxss is as follows: Add in item1:Flex-grow: 1, Add i3, indicating that if there is space remaining in a row, the child view outside i3 occupies 1 space, and the i3 child view occupies 2 Space. the compilation and running effect is 10: it can be
= integer.valueof (100);
When to automatically remove the box
Auto-unpacking (unboxing), that is, the basic data in the object is automatically removed from the object. Automatic unpacking can be implemented as follows:1 Integer i = 10; Packing2 int t = i; Unpacking, actually executing an int t = I.intvalue ();It is also possible to disassemble the container while the operation is in progress.1 Integer i = 10;2 System.out.println (i++);
Automatic boxing of integers
T
automatically compiles the following syntax for you: Integer i = integer.valueof (100);
When to automatically remove the box
Auto-unpacking (unboxing), that is, the basic data in the object is automatically removed from the object. Automatic unpacking can be implemented as follows:1 Integer i = 10; Packing2 int t = i; Unpacking, actually executing an int t = I.intvalue ();It is also possible to disassemble the container while the operation is in progress.1 Integer i = 10;2 System.
boxing process is implemented by calling the wrapper's ValueOf method, and the unboxing process is implemented by invoking the wrapper's Xxxvalue method. (XXX represents the corresponding basic data type).Three. Questions related to the interviewWhile most people are clear about the concept of boxing and unpacking, the question of packing and unpacking in interviews and written tests does not necessarily answer. Here are some common questions related to packing/unpacking.1. What is the output o
= integer.valueof (100);
When to automatically remove the box
Auto-unpacking (unboxing), that is, the basic data in the object is automatically removed from the object. Automatic unpacking can be implemented as follows:1 Integer i = 10; Packing2 int t = i; Unpacking, actually executing an int t = I.intvalue ();It is also possible to disassemble the container while the operation is in progress.1 Integer i = 10;2 System.out.println (i++);
Automatic boxing of integers
());System.out.println (now);return D2;}(4) Quarantine reference: In this case, the object being reclaimed still has a reference, which is known as the isolated island. If there are two instances, they reference each other, and all other references to both objects are deleted, and no other thread can access either of the two objects. can also meet garbage collection conditions.Java codepublic class Island {Island I;public static void Main (string[] args) {Island i2 = new Island ();Island
*---------------------------------------------------------------------------*_2_ member Method access rights The verification * Public Private protected defaults (default permissions) * Own package own class accessible accessible * access accessible * Own package other classes accessible Ask access to accessible * Other packages other classes access inaccessible inaccessible unreachable * Own package other classes have inheritance relationships access inaccessible accessible * Other packages ot
when boxing. And in the unboxing of the automatic call is the integer Intvalue method.
Others are similar, such as Double, Character, do not believe that a friend can manually try it.
So you can summarize the process of boxing and unboxing in a word:
The boxing process is implemented by invoking the ValueOf method of the wrapper, and the unboxing process is implemented by invoking the Xxxvalue method of the wrapper. (XXX represents the corresponding basic data type).
Three. Related question
.) Similarly, Other encapsulation classes and basic types are also the same.
In JDK or later versions, the basic type and encapsulation class can be automatically converted, similar to the String type object and String constant.
Integer i1 = 123;
Integer i2 = 123;
Int I = 123;
Integer i3 = new Integer (123); Integer i4 = new Integer (123 );
System. out. println ("i1 = i2 =" + (i1 = i2 ));
System. out. println ("i1.equals (i2) =" + (i1.equals (i2 )));
","6","Q","Y","8","L"};/** * Invitation code generator * @param ID is greater than or equal to 1 and less than or equal to 32^6 * @return ID corresponding to the 6-bit 32 binary invitation code */ Public Static FinalStringGenerate(LongID) {if(ID 1|| ID > Math.pow ( +,6)) {Throw NewRuntimeException ("failed to generate the invitation code >> parameter values are not within the specified range"); }intI1, I2, i3, I4, i5, I6; I1 = (int) ((ID-1)/Math.p
Dim i as Integer, J As Integer, K As Integer, L As Integer Dim m As Integer, n as Integer, I1 as Integer, I2 As Integer Dim i3 As Integer, I4 As Integer, i5 as Integer, I6 As Integer Dim PWord1 As String Dim Shtag As Boolean, Wintag as Boolean application.screenup Dating = False with ActiveWorkbook Wintag =. ProtectStructure Or. Protectwindows End With Shtag = False for each w1 in worksheets Shtag = Shtag Or W1. ProtectContents Next W1 If not shtag a
This problem has taught me to re-learn the operation of multiply in the interval.Puzzle: Http://blog.csdn.net/guognib/article/details/25324025?utm_source=tuicoolutm_medium=referralCode: Also refer to the above writtenNote: There is really a priority, plus only affect themselves, multiply will affect the plus, reset value will clear 0 all the marksSo when you go down, multiply and add the operation is later than the last set value, and then multiply the operation to precede the additionSo first p
= "this file worksheet is not encrypted 2"Const msgtaketime as string = "please be patient! " Dblspace " reply by OK"Const msgpwordfound1 as string = "password combination:" dblspace "$" dblspace _"If the worksheet of this file has different passwords, search for the next set of passwords and modify and clear them"Const msgpwordfound2 as string = "password combination:" dblspace "$" dblspace _"If the worksheet of this file has different passwords, search for the next group of passwords an
protocol. It's not going to be wrong if you don't.
Example
public class Equaltest {public static void Main (string[] args) {For variables of the base type. The difference between "= =" and "equal"int t1=57;int t2=67;int t3=124;int t4=124;"= =" for basic data types, determine whether the values of two variables are equal.Boolean result1= (T1==T2);Boolean result2= ((t1+t2) ==t3);Boolean result3= (T3==T4);System.out.println ("\ n \ Nand-----" T1==T2 "" +result1+ "\ n-----" (t1+t2) =t3 "+result
potential the future use of other workbooks by" _"The same person who is set this password." Dblspace _"Now to check and clear other passwords." AUTHORS versionconst MSGPWORDFOUND2 as String="You had a Worksheet" _"password set." Dblspace "The password found was:"_dblspace"$$" Dblspace "Note It down for potential" _"Workbooks by same" _"set this password." Dblspace "Now to check and clear" _"Other passwords." AUTHORS versionconst Msgonlyone as String="Only structure/windows" _"protected with t
same person who set this password." dblspace _"Now to check and clear other passwords." authors versionConst msgpwordfound2 as string = "You had a worksheet "_"Password set." dblspace "the Password Found was :"_Dblspace "$" dblspace "note it down for potential "_"Future use in other workbooks by same person who "_"Set this password." dblspace "now to check and clear "_"Other passwords." authors versionConst msgonlyone as string = "only structure/Windows "_"Protected with the passwor
This blog has repeatedly mentioned Mathematica, a super mathematical software, but so far I have not found its Linux version, and wine seems useless. In fact, there are many Mathematica-like mathematical software in Linux, among which maxima is the one I use most. Here, I will briefly introduce various maxima functions for your reference and facilitate future queries.
Install: sudo apt-Get install maxima-shareRun: MaximaExit: Quit ();
Basic operations(%i1) 2+3;(%o1)5(%i2) 5*6;(%o2) 30(%
specification." dblspace _"Just be patient! Make me a coffee! " Authors versionConst msgpwordfound1 as string = "You had a worksheet "_"Structure or Windows password set." dblspace _"The Password Found was:" dblspace "$" dblspace _"Note it down for potential future use in other workbooks "_"The same person who set this password." dblspace _"Now to check and clear other passwords." authors versionConst msgpwordfound2 as string = "You had a worksheet "_"Password set." dblspace "the Pas
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.