= integer. valueof (intstr );
Return integer. intvalue ();
}
// Change int type to the string type
Public static string inttostring (INT value)
{
Integer integer = new INTEGER (value )
The difference between int and integer1, integer is the wrapper class int, int is a basic data type of Java2. The integer variable must be instantiated before it can be used, and the int variable does not need3, the integer is actually a reference to the object, when new an integer, is actually generated a pointer to t
The difference between int and integer1, integer is the wrapper class int, int is a basic data type of Java2. The integer variable must be instantiated before it can be used, and the int variable does not need3, the integer is actually a reference to the object, when new an integer, is actually generated a pointer to t
)/10! =result)8{return0; }9result =Newresult;Tenx = X/10; One } A returnresult; -}There is no justice .... 13 lines will be done?!Answer Ideas :1, because the negative number for the remainder and divided by 10 or negative , so do not need to record symbols.2, because if the current reversal of the first number is zero, multiplied by 10 or 0 , so do not need to record with the list.3, because multiplying by 10 plus a value may overflow
There are eight basic data types in http://qxzxcjq-126-com.iteye.com/blog/883283 java: int, char, Boolean, Byte, long, double, float, short. Java is an object-oriented programming language, and data is an object in Java. The object we created with the base data type, such as int x = 0, where x has only the value of thi
About the comparison of integers and int1. Because the integer variable is actually a reference to an integer object, the two integer variables generated by new are never equal (because new generates two objects with different memory addresses).Integer i = new Integer(100);
. Again, the Intvalue () method is called by the unboxing.3) The comparison between integersThis is relatively simple, directly to the two reference value (that is, the address that stores the target data) to compare the line, no more unpacking, boxing or anything.4) The comparison between intThis, too, directly compares the values of the two variables.It is important to note that for an integer object, the
1, int is the basic data type, the int variable stores the numeric value. An integer is a reference type, which is actually an object, and the integer stores the address of the referenced object.2.Integer i = new integer (100);Integer
Java is an object-oriented programming language, everything is an object, but for the convenience of programming or introduce basic data types, in order to be able to use these basic data types as Object operations, Java for each basic data type has introduced the corresponding wrapper type (wrapper class), int's wrapper class is integer, starting with
Integer.valueof () has an inner class integercache (similar to a constant array, also called an object pool) that maintains an integer array cache with a length of (128+127+1) = There is also a static block in the 256;integer classstatic {for (int i = 0; i As you can see from this static block, the integer cache data for the
integer class in the following ways:
1 Integer int1=10; 2 Integer int2=integer.valueof (10);
View Code
Will get the same instance on the cache pool.
So if the value is between 128 and 127, you will get the same reference using valueof (), which will return the new Integer
Java is an object-oriented programming language, everything is object, but for the convenience of programming or the introduction of basic data types, in order to be able to use these basic data types as objects, Java for each of the basic data types introduced a corresponding wrapper type (wrapper class), int's wrapper class is integer, starting with
1 how to convert a string to an integer Int?
A. There are two methods:
1). Int I = integer. parseint ([String]); or
I = integer. parseint ([String], [int Radix]);
2). Int I = integer. valueof (my_str). intvalue ();
Note: The methods for converting strings to double, float, and long are similar.
2. How do I convert an
First, the basic type of JavaThe Java language provides eight basic types, including six numeric types (four integers, two floating-point types), one character type, and one Boolean type.
Integer type, including Byte, short, int, long, the default initial value is 0;
Floating point type, including float, double, default initial
The difference between a Java int and an integerThe difference between an int and an integer is, in large terms, the difference between the basic data type and its wrapper class:int is the basic type, the value is stored directly, and the integer is the object, pointing to the object with a referenceData types in 1.
The difference between a Java int and an integerThe difference between an int and an integer is, in large terms, the difference between the basic data type and its wrapper class:int is the basic type, the value is stored directly, and the integer is the object, pointing to the object with a referenceData types in 1.
The difference between an int and an integer is, in large terms, the difference between the basic data type and its wrapper class:int is the basic type, the value is stored directly, and the integer is the object, pointing to the object with a referenceData types in 1.Java are divided into basic data types and complex
The difference between a Java int and an integerThe difference between an int and an integer is, in large terms, the difference between the basic data type and its wrapper class:int is the basic type, the value is stored directly, and the integer is the object, pointing to the object with a referenceData types in 1.
Transferred from: http://www.cnblogs.com/shenliang123/archive/2011/10/27/2226903.htmlThe difference between an int and an integer is, in large terms, the difference between the basic data type and its wrapper class:int is the basic type, the value is stored directly, and the integer is the object, pointing to the object with a referenceData types in 1.
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.