One.There are eight basic data types: Byte,short,int,long,float,double,char,boolean. In the world of Java, everything is object. To make it easier to manipulate the basic data type values, we encapsulate them in objects, and classes that describe the basic data types are called basic data type Object wrapper classes.There are eight basic data types, which means there are eight
(1) The double class and the float class implement the class wrapper of the double and float basic data. Use the construction method of the double class double (double num) to create a double type of data, and the double object calls the Doublevalue () method to return the t
OverviewThe benefit of encapsulating basic data types into objects, based on the idea of everything in Java, is that you can define more functional methods in an object to manipulate the data. The most common function of the basic data type Object wrapper class is to convert between the base data type and the string type.
corresponding RelationshipData type
representation and converted to a decimal System.out.println (Integer.parseint ("3C", 16));}}Automatic packing and unpackingpublic class Main {public static void main (string[] args) {integer a = new Integer ("3"); integer b = new Integer (3); System.out.println (A = = B);//Two new addresses must be different System.out.println (A.equals (b));//equals compares content System.out.println ( A.compareto (b)); int num = 5;num++;integer Xinteger = 5;//xin
A basic type wrapper classThe underlying data type is stored in the stack area of the memory, and you can convert the underlying data type to a reference data type by wrapping the class, that is, in the heap and stack.There are 8 kinds of basic data types, and there are 8 kinds of packaging classes. Byte,short,integer,long,float,double,character,boolean, respectively. ClassThe
Java Basic type wrapper class:Basic data type Basic type wrapper classBYTE byteShort Shortint IntegerLong Longfloat floatDouble DoubleChar CharacterBoolean BooleanHere is a representative explanation of the integers and charater classes.Integer classThe Integer class wraps the value of a primitive type int in the objec
Note that the comparison between instances of the wrapper class is not straightforward with the = = Public Static voidMain (string[] args) {//TODO auto-generated Method StubInteger A =NewInteger (1); Integer b=NewInteger (1); intC=1; Integer e= 1; System.out.println ("A==b:" + (a==b)); System.out.println ("A==c:" + (a==c)); System.out.println ("A==e:" + (a==e)); System.out.println ("C==e:" + (c==e)); }R
MyBatis Wrapper Java Common class for paged queriesPaging----is essential for queries that have a large amount of data. MyBatis the underlying paging SQL statement because we need to write manually. When paging is implemented, we need to query the total number of records and the details of the records according to the paged query criteria. Therefore, if we do not
Reprinted from Http://zhidao.baidu.com/question/2052192149152534987.htmlFirst, the conversion between the basic data types is not all convertible, and you cast problems, such as the conversion of string type int type, then the JDK for the convenience of users to provide the appropriate wrapper class.Example:public class integer{private int i;Public Integer (int a) {I =a;}public static int Parsetoint () {ret
Basic data type Object wrapper classBYTE byteShort Shortint IntegerBoolean Booleanfloat floatDouble DoubleChar CharacterThe most common function of the basic data type Object wrapper class is to convert between the base data type and the string typeConvert base data type to StringBasic data type + ""Base data type. toString (base data type value)For example: Inte
I. Packing CLASS definition Java is not a purely object-oriented language. The Java language is an object-oriented language, but Java's basic data types are not object-oriented. But we are actually makingIt is often necessary to convert basic data into objects for ease of operation. For example: In the operation of a collection, this is where we need to convert t
Objective: In order to conveniently manipulate the basic data type value, encapsulate it as an object, define the property and behavior in the object, enrich the operation of data modification, and the class used to describe the object becomes the basic data type Object wrapper class.For example: The value range of type int: Integer------>integer.max_value8 Types of data
){ - //Public Static Boolean islowercase (char ch): Determines whether the given character is lowercase characters - if(Character.islowercase (ch[x])) { -Smallcount + +; - } - Else if(Character.isuppercase (ch[x])) { inBigcount + +; - } to Else if(Character.isdigit (ch[x])) { +Numbercount + +; - } the } *System.out.println ("The lowercase letters in a string have a total of" +smallcount+ "); $SYSTEM.OUT.PRINTLN ("Uppercase letters in a string have a total of" +bigcount+ ");Panax NotoginsengSyst
PackageOrg.hanqi.array; Public classBaozhuang { Public Static voidMain (string[] args) {//Packing classLong l=NewLong (100); Long L1=NewLong ("1000"); String Str=1000+ "";//value into string LongL2=l1.longvalue ();//The string is converted to a numeric value, from the wrapper class to the basic data typeSystem.out.println ("12 =" +L2); LongL3=long.parselong ("1200");//static methods are converted fro
1. Packaging Class IntroductionPackage cn;/** * Calculates 100 binary, octal, and hex of this data to determine if a data is within the INT range * */public class Integerdemo {public static void main (string[] args) {System.out.println ("100 Binary is:" +integer.tobinarystring);//1100100system.out.println ("Octal 100 is:" + Integer.tooctalstring (+));//144system.out.println ("100 Hex is:" +integer.tohexstri
The Java language provides eight basic types. Six numeric types (four integers, two floating-point types), one character type, and one Boolean type.
1, Integer: Including Int,short,byte,long, the initial value of 0
2, floating-point type: float,double, the initial value is 0.0
3, Character: Char, the initial value is a space, that is, "", if the output, in the console is not see the effect.
4, Boolean: Boolean, initial value is False
B
wrapper classes (e.g., integer,double, etc.) these classes encapsulate a corresponding base data type value and provide it with a series of operations.Take the Java.lang.Integer class, for example, to construct the method:Integer (int value);Integer (String s);Common methods:public static final int max_value: Maximum int type (2^31-1)public static final int min_value: Smallest int type ( -2^31)Public long L
parameter, the incoming address.Then execute the method change program:When performing a change to the value of the I1, at this point I1 the object to the [email protected], this can fully explain the problem is not automatic boxing and unpacking, but the reason, my understanding is related to this, because the implementation of this step is I1 = 100; But the compiler optimized it for automatic boxing, var0 = integer.valueof (100), so i1 points to the newly created object integer.valueof (100),
The wrapper class is used in the collection to define the type of the collection element.1. Minimum value of Integer.MIN_VALUE:int type: -2^312. Maximum value of Integer.MAX_VALUE:int type: 2^31-13, int integer.parseint (String sinteger);Effect: Converts an integer of type string to data of type int.4, String integer.tobinarystring (int value);Function: Converts the decimal number to binary and returns the
-Basic data type Object wrapper class.
Byte
Byte
Short
Short
Int
Integer
Long
Long
Boolean
Boolean
Double
Double
Float
Float
Char
Character
The most common role of the basic data type Object wrapper
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.