1. Data Types in Java are classified into basic data types and complex data types.
Int Is the former, and integer is the latter (that is, a class ).
2. During Initialization
CopyCode The Code is as follows: int I = 1;
Integer I = new INTEGER (1); // (use integer as
Original source: http://hi.baidu.com/eduask%C9%BD%C8%AA/blog/item/227bf4d81c71ebf538012f53.html package com.test; public class Test { public static void main (String []args) {Integer a = 100; // If you use new here, the = = value must be false Integer B = 100; System.out.println (a ==b); // true In
Before we start with a detailed explanation of the problem, let's look at a piece of code1 Public Static void Compare1 () {2 Integer i1 = 127, I2 = 127, i3 = $, i4 =; 3 System.out.println (i1 = = i2); 4 System.out.println (i1.equals (I2)); 5 SYSTEM.OUT.PRINTLN (i3 = = i4); 6 System.out.println (I3.equals (I4)); 7 }What is the result of this code output?The answer is:Was it strange? Why 127 when = = is tru
, Arrays.sort (); provides the array ascending sort functionBut there is no descending sort function, someone tried to use Arrays.sort (array, Collections.reverseorder ()), to solve this problem, but this code for int array[] = {8, 7, 100, 88, 6, 4, 5, 33, 10}; is not compiled, for integer array[] = {8, 7, 100, 88, 6, 4, 5, 33, 10}; OK, for example:Integer array[] = {8, 7, 100, 88, 6, 4, 5, 33, 10}; System.out.println (arrays.tostring (array)); Arrays
1, ideas and points of attention reference: http://blog.sina.com.cn/s/blog_514c89a90100d7qh.htmlThere are a few things to summarize 1) The string begins with the "+" sign or the "-" number of the processing 2) of the illegal character's judgment (not the number) 3) integer overflow problem. Look at how the source code for Integer.parseint (String Sting) in the Java library handles these problems./** * Parse
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
1, the data types in Java are divided into basic data types and complex data types
int is the former, and the integer is the latter (i.e. a class).
2. When initializing
Copy Code code as follows:
int i = 1;
Integer i = new integer (1); (To see the integer
int and integer differences in Java
int is the basic type, direct deposit value
An integer is an object that points to this object with a reference
The int and integer relationships in Java are more subtle. The relationship is
This article illustrates the method of transforming IP and integer in java. Share to everyone for your reference. The specific analysis is as follows:
I. Basic points of knowledge
ip--> integer:
Converts an IP address into an array of bytes
Via left shift (
Integer--> IP:
The
-----------Android Training, Java training, Java Learning Technology blog, look forward to communicating with you! ------------ Time--January 6, 2016 15:33:02 1, integer class range of values and their analysis? we know that the range of values for shaping is -2^31~2^31-1, but I wonder why negative numbers are not minus 1, and integers are minus 1. In addition t
Tips"Effective Java, third Edition" an English version has been published, the second edition of this book presumably many people have read, known as one of the four major Java books, but the second edition of 2009 published, to now nearly 8 years, but with Java 6, 7, 8, and even 9 of the release, the Java language has
Everything in Java is an object, because there are basic data types.Basic data types have a corresponding base data Type Packager, and their base data Type Packager is an object.J2SE 5.0 introduces boxing and unboxing, which are the relationship between the basic data type and the basic data Type PackagerLong and longLong's inheritance relationship:A few messages:1, long by final modification, not variable2. Parent class is abstract class number3, rea
values. * This method would always have the cache valuesin the range-128 to 127, * inclusive, and could cache other value s outside of this range. * * @paramI an {@codeint} value. * @returnAn {@codeInteger} instance representing {@codei}. *@since1.5*/ Public StaticInteger ValueOf (inti) {assertIntegercache.high >= 127; if(I >= integercache.low i Integercache.high)returnIntegercache.cache[i + (
1. The large aspect of int and integer is 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, with a reference to that object, which is a complex data type.2. When initializing:The variable of int is initialized to NULL as a variable of 0,integer.int i =1;
First, let's look at a piece of code (using JDK 5), as shown below:
public class Hello { public static void main(String[] args) { int a = 1000, b = 1000; System.out.println(a == b); Integer c = 1000, d = 1000; System.out.println(c == d); Integer e = 100, f = 100; System.out.println(e == f); } }
Output result:
truefalsetrue
The Java
In Java, the minimum and maximum values for an Integer are defined as follows:
/**
* A constant holding the minimum value an {@code int} can
* have, -2
The minimum value is -2^31, the maximum value is 2^31-1, why? The derivation process is as follows: the number of digits
limitation mentioned above is applied during compilation and does not work during runtime.
Now that we understand this, we can imagine how to pass in the Set object to the non-qualified type value under the type limitation through the compilation period. So let's take a look at the following question. The solution has been implemented in the above Code.How to pass a String object to an Integer-type generic
This article illustrates the method of transforming IP and integer in java. Share to everyone for your reference. The specific analysis is as follows:
I. Basic points of knowledge
ip--> integer:Converts an IP address into an array of bytesConvert to int by left shift (Integer--> IP:The integer
whether the size of your assignment is contained within the Integercache cache array.If a reference to the object is returned, and thus less than or equal to 127 is greater than or equal to-128, the result can be obtained by = = Comparison to True, because the reference is the same, The number of out-of-range calls the integer constructor to recreate an integer object so that the
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.