1. toString()来源

2. toString()目的

3. toString()实现(JDK8)

1. toString()来源

  源于java.lang.Object类,源码如下:

    /**
* Returns a string representation of the object. In general, the
* {@code toString} method returns a string that
* "textually represents" this object. The result should
* be a concise but informative representation that is easy for a
* person to read.
* It is recommended that all subclasses override this method.
* <p>
* The {@code toString} method for class {@code Object}
* returns a string consisting of the name of the class of which the
* object is an instance, the at-sign character `{@code @}', and
* the unsigned hexadecimal representation of the hash code of the
* object. In other words, this method returns a string equal to the
* value of:
* <blockquote>
* <pre>
* getClass().getName() + '@' + Integer.toHexString(hashCode())
* </pre></blockquote>
*
* @return a string representation of the object.
*/
public String toString() {
return getClass().getName() + "@" + Integer.toHexString(hashCode());
}

2. toString()目的

  返回对象的字符串描述,是该对象的文本表示。该表示必须描述简洁且包含了该对象的信息,便于阅读。

  推荐所有的子类重写该方法。

3. toString()实现(JDK8)

(1)Object类中的实现

  在Object类中,该方法返回的是“该实例对象的类名@该对象的hashcode的十六进制表示”。对于我们而言,能阅读到的仅仅是该实例的类名。所以推荐对Object的子类重写该方法。

(2)包装类中的实现

 ① Boolean

    /**
* Returns a {@code String} object representing this Boolean's
* value. If this object represents the value {@code true},
* a string equal to {@code "true"} is returned. Otherwise, a
* string equal to {@code "false"} is returned.
*
* @return a string representation of this object.
*/
public String toString() {
return value ? "true" : "false";
}

② Byte(借助于Integer)

    /**
* Returns a new {@code String} object representing the
* specified {@code byte}. The radix is assumed to be 10.
*
* @param b the {@code byte} to be converted
* @return the string representation of the specified {@code byte}
* @see java.lang.Integer#toString(int)
*/
public static String toString(byte b) {
return Integer.toString((int)b, 10);
}
/**
* Returns a {@code String} object representing this
* {@code Byte}'s value. The value is converted to signed
* decimal representation and returned as a string, exactly as if
* the {@code byte} value were given as an argument to the
* {@link java.lang.Byte#toString(byte)} method.
*
* @return a string representation of the value of this object in
* base&nbsp;10.
*/
public String toString() {
return Integer.toString((int)value);
}

③ Short(借助于Integer)

    /**
* Returns a new {@code String} object representing the
* specified {@code short}. The radix is assumed to be 10.
*
* @param s the {@code short} to be converted
* @return the string representation of the specified {@code short}
* @see java.lang.Integer#toString(int)
*/
public static String toString(short s) {
return Integer.toString((int)s, 10);
}
/**
* Returns a {@code String} object representing this
* {@code Short}'s value. The value is converted to signed
* decimal representation and returned as a string, exactly as if
* the {@code short} value were given as an argument to the
* {@link java.lang.Short#toString(short)} method.
*
* @return a string representation of the value of this object in
* base&nbsp;10.
*/
public String toString() {
return Integer.toString((int)value);
}

④ Character

    /**
* Returns a {@code String} object representing this
* {@code Character}'s value. The result is a string of
* length 1 whose sole component is the primitive
* {@code char} value represented by this
* {@code Character} object.
*
* @return a string representation of this object.
*/
public String toString() {
char buf[] = {value}; // 转换为数组,可能和code point有关
return String.valueOf(buf);
}
https://blog.csdn.net/qlql489/article/details/82780716

⑤ Integer

    /**
* All possible chars for representing a number as a String
所有可表示的进制下的所有字符
*/
final static char[] digits = {
'0' , '1' , '2' , '3' , '4' , '5' ,
'6' , '7' , '8' , '9' , 'a' , 'b' ,
'c' , 'd' , 'e' , 'f' , 'g' , 'h' ,
'i' , 'j' , 'k' , 'l' , 'm' , 'n' ,
'o' , 'p' , 'q' , 'r' , 's' , 't' ,
'u' , 'v' , 'w' , 'x' , 'y' , 'z'
}; /**
* Returns a string representation of the first argument in the
* radix specified by the second argument.
* 返回第一个参数的字符串表示,进制为第二个参数 * <p>If the radix is smaller than {@code Character.MIN_RADIX}
* or larger than {@code Character.MAX_RADIX}, then the radix
* {@code 10} is used instead.
* 如果进制参数不再Character的可表示的进制范围内,设为十进制 * <p>If the first argument is negative, the first element of the
* result is the ASCII minus character {@code '-'}
* ({@code '\u005Cu002D'}). If the first argument is not
* negative, no sign character appears in the result.
* 如果第一个参数是负数,则返回的字符串第一个字符是‘-’,否则为无符号 * <p>The remaining characters of the result represent the magnitude
* of the first argument. If the magnitude is zero, it is
* represented by a single zero character {@code '0'}
* ({@code '\u005Cu0030'}); otherwise, the first character of
* the representation of the magnitude will not be the zero
* character. The following ASCII characters are used as digits:
* 结果的剩余字符串表示了第一个参数的大小,如果参数为0,则返回‘0’,否则字符串的第一个字符不为0。使用ASCII字符:0-9a-z * <blockquote>
* {@code 0123456789abcdefghijklmnopqrstuvwxyz}
* </blockquote>
*
* These are {@code '\u005Cu0030'} through
* {@code '\u005Cu0039'} and {@code '\u005Cu0061'} through
* {@code '\u005Cu007A'}. If {@code radix} is
* <var>N</var>, then the first <var>N</var> of these characters
* are used as radix-<var>N</var> digits in the order shown. Thus,
* the digits for hexadecimal (radix 16) are
* {@code 0123456789abcdef}. If uppercase letters are
* desired, the {@link java.lang.String#toUpperCase()} method may
* be called on the result:
*
* <blockquote>
* {@code Integer.toString(n, 16).toUpperCase()}
* </blockquote>
*
* @param i an integer to be converted to a string.
* @param radix the radix to use in the string representation.
* @return a string representation of the argument in the specified radix.
* @see java.lang.Character#MAX_RADIX
* @see java.lang.Character#MIN_RADIX
*/
public static String toString(int i, int radix) {
// 进制范围
if (radix < Character.MIN_RADIX || radix > Character.MAX_RADIX)
radix = 10; /* Use the faster version */
if (radix == 10) {
return toString(i);
} // 除十进制外的其他进制
// 返回的字符串,最长为33个字符(32个二进制+1个符号)
char buf[] = new char[33];
// 记录正负
boolean negative = (i < 0);
int charPos = 32;
// 保证i<=0
if (!negative) {
i = -i;
}
// 从后往前转字符 123->3,2,1
while (i <= -radix) {
buf[charPos--] = digits[-(i % radix)];
i = i / radix;
}
// 最高位
buf[charPos] = digits[-i];
// 符号位
if (negative) {
buf[--charPos] = '-';
}
// 返回不为0的字符部分
return new String(buf, charPos, (33 - charPos));
}
/**
* Returns a {@code String} object representing the
* specified integer. The argument is converted to signed decimal
* representation and returned as a string, exactly as if the
* argument and radix 10 were given as arguments to the {@link
* #toString(int, int)} method.
*
* @param i an integer to be converted.
* @return a string representation of the argument in base&nbsp;10.
*/
// 十进制
public static String toString(int i) {
// 无法得到最小值的绝对值(超范围)
if (i == Integer.MIN_VALUE)
return "-2147483648";
// 需要的字符个数
int size = (i < 0) ? stringSize(-i) + 1 : stringSize(i);
char[] buf = new char[size];
getChars(i, size, buf);
return new String(buf, true);
}
// Requires positive x
// 该十进制表示需要的位数(不包括符号)
static int stringSize(int x) {
for (int i=0; ; i++)
if (x <= sizeTable[i])
return i+1;
}
final static int [] sizeTable = { 9, 99, 999, 9999, 99999, 999999,
9999999,99999999, 999999999, Integer.MAX_VALUE };
/**
* Places characters representing the integer i into the
* character array buf. The characters are placed into
* the buffer backwards starting with the least significant
* digit at the specified index (exclusive), and working
* backwards from there.
*
* Will fail if i == Integer.MIN_VALUE 最小值的绝对值超范围
*/
static void getChars(int i, int index, char[] buf) {
int q, r;
int charPos = index;
char sign = 0; if (i < 0) {
sign = '-';
i = -i;
} // Generate two digits per iteration
// 一次迭代产生两位字符,从低到高
while (i >= 65536) {
q = i / 100;
// really: r = i - (q * 100);
r = i - ((q << 6) + (q << 5) + (q << 2));
i = q;
buf [--charPos] = DigitOnes[r];
buf [--charPos] = DigitTens[r];
} // Fall thru to fast mode for smaller numbers
// assert(i <= 65536, i);
// 以65536为分界线,下面使用移位和乘法的形式提高速度,
// 所以(i*52429)不能超过Integer.MAX_VALUE,2^15 < 52429 < 2^16,所以i<2^16,所以这里i的值不能超过65536

for (;;) {
// 2^19 = 524288,52429>>>19=0.1xxx
// 移位最快,乘 > 除
q = (i * 52429) >>> (16+3); // q = i/10;
r = i - ((q << 3) + (q << 1)); //
r = i-(q*10) ...
buf [--charPos] = digits [r];
i = q;
if (i == 0) break;
}
if (sign != 0) {
buf [--charPos] = sign;
}
}
final static char [] DigitTens = {
'0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
'1', '1', '1', '1', '1', '1', '1', '1', '1', '1',
'2', '2', '2', '2', '2', '2', '2', '2', '2', '2',
'3', '3', '3', '3', '3', '3', '3', '3', '3', '3',
'4', '4', '4', '4', '4', '4', '4', '4', '4', '4',
'5', '5', '5', '5', '5', '5', '5', '5', '5', '5',
'6', '6', '6', '6', '6', '6', '6', '6', '6', '6',
'7', '7', '7', '7', '7', '7', '7', '7', '7', '7',
'8', '8', '8', '8', '8', '8', '8', '8', '8', '8',
'9', '9', '9', '9', '9', '9', '9', '9', '9', '9',
} ;
// 10x10
final static char [] DigitOnes = {
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
} ; /**
* Returns a {@code String} object representing this
* {@code Integer}'s value. The value is converted to signed
* decimal representation and returned as a string, exactly as if
* the integer value were given as an argument to the {@link
* java.lang.Integer#toString(int)} method.
*
* @return a string representation of the value of this object in
* base&nbsp;10.
*/
public String toString() {
return toString(value);
}
两个toString,一个是在多进制下转字符串,有多少位就要循环多少次。
toString(value)的方法默认为十进制,毕竟使用的多,而上面的方法太慢了,toString(value)明显减少了迭代次数。

⑥ Long(同Integer)

   /**
* Returns a string representation of the first argument in the
* radix specified by the second argument.
*
* <p>If the radix is smaller than {@code Character.MIN_RADIX}
* or larger than {@code Character.MAX_RADIX}, then the radix
* {@code 10} is used instead.
*
* <p>If the first argument is negative, the first element of the
* result is the ASCII minus sign {@code '-'}
* ({@code '\u005Cu002d'}). If the first argument is not
* negative, no sign character appears in the result.
*
* <p>The remaining characters of the result represent the magnitude
* of the first argument. If the magnitude is zero, it is
* represented by a single zero character {@code '0'}
* ({@code '\u005Cu0030'}); otherwise, the first character of
* the representation of the magnitude will not be the zero
* character. The following ASCII characters are used as digits:
*
* <blockquote>
* {@code 0123456789abcdefghijklmnopqrstuvwxyz}
* </blockquote>
*
* These are {@code '\u005Cu0030'} through
* {@code '\u005Cu0039'} and {@code '\u005Cu0061'} through
* {@code '\u005Cu007a'}. If {@code radix} is
* <var>N</var>, then the first <var>N</var> of these characters
* are used as radix-<var>N</var> digits in the order shown. Thus,
* the digits for hexadecimal (radix 16) are
* {@code 0123456789abcdef}. If uppercase letters are
* desired, the {@link java.lang.String#toUpperCase()} method may
* be called on the result:
*
* <blockquote>
* {@code Long.toString(n, 16).toUpperCase()}
* </blockquote>
*
* @param i a {@code long} to be converted to a string.
* @param radix the radix to use in the string representation.
* @return a string representation of the argument in the specified radix.
* @see java.lang.Character#MAX_RADIX
* @see java.lang.Character#MIN_RADIX
*/
public static String toString(long i, int radix) {
if (radix < Character.MIN_RADIX || radix > Character.MAX_RADIX)
radix = 10;
if (radix == 10)
return toString(i);
char[] buf = new char[65];
int charPos = 64;
boolean negative = (i < 0); if (!negative) {
i = -i;
} while (i <= -radix) {
buf[charPos--] = Integer.digits[(int)(-(i % radix))];
i = i / radix;
}
buf[charPos] = Integer.digits[(int)(-i)]; if (negative) {
buf[--charPos] = '-';
} return new String(buf, charPos, (65 - charPos));
}
/**
* Returns a {@code String} object representing the specified
* {@code long}. The argument is converted to signed decimal
* representation and returned as a string, exactly as if the
* argument and the radix 10 were given as arguments to the {@link
* #toString(long, int)} method.
*
* @param i a {@code long} to be converted.
* @return a string representation of the argument in base&nbsp;10.
*/
public static String toString(long i) {
if (i == Long.MIN_VALUE)
return "-9223372036854775808";
int size = (i < 0) ? stringSize(-i) + 1 : stringSize(i);
char[] buf = new char[size];
getChars(i, size, buf);
return new String(buf, true);
}
/**
* Places characters representing the integer i into the
* character array buf. The characters are placed into
* the buffer backwards starting with the least significant
* digit at the specified index (exclusive), and working
* backwards from there.
*
* Will fail if i == Long.MIN_VALUE
*/
static void getChars(long i, int index, char[] buf) {
long q;
int r;
int charPos = index;
char sign = 0; if (i < 0) {
sign = '-';
i = -i;
} // Get 2 digits/iteration using longs until quotient fits into an int
while (i > Integer.MAX_VALUE) {
q = i / 100;
// really: r = i - (q * 100);
r = (int)(i - ((q << 6) + (q << 5) + (q << 2)));
i = q;
buf[--charPos] = Integer.DigitOnes[r];
buf[--charPos] = Integer.DigitTens[r];
} // Get 2 digits/iteration using ints
int q2;
int i2 = (int)i;
while (i2 >= 65536) {
q2 = i2 / 100;
// really: r = i2 - (q * 100);
r = i2 - ((q2 << 6) + (q2 << 5) + (q2 << 2));
i2 = q2;
buf[--charPos] = Integer.DigitOnes[r];
buf[--charPos] = Integer.DigitTens[r];
} // Fall thru to fast mode for smaller numbers
// assert(i2 <= 65536, i2);
for (;;) {
q2 = (i2 * 52429) >>> (16+3);
r = i2 - ((q2 << 3) + (q2 << 1)); // r = i2-(q2*10) ...
buf[--charPos] = Integer.digits[r];
i2 = q2;
if (i2 == 0) break;
}
if (sign != 0) {
buf[--charPos] = sign;
}
} // Requires positive x
static int stringSize(long x) {
long p = 10;
for (int i=1; i<19; i++) {
if (x < p)
return i;
p = 10*p;
}
return 19;
}
/**
* Returns a {@code String} object representing this
* {@code Long}'s value. The value is converted to signed
* decimal representation and returned as a string, exactly as if
* the {@code long} value were given as an argument to the
* {@link java.lang.Long#toString(long)} method.
*
* @return a string representation of the value of this object in
* base&nbsp;10.
*/
public String toString() {
return toString(value);
}

⑦ Float

    /**
* Returns a string representation of the {@code float}
* argument. All characters mentioned below are ASCII characters.
* <ul>
* <li>If the argument is NaN, the result is the string
* "{@code NaN}".
* <li>Otherwise, the result is a string that represents the sign and
* magnitude (absolute value) of the argument. If the sign is
* negative, the first character of the result is
* '{@code -}' ({@code '\u005Cu002D'}); if the sign is
* positive, no sign character appears in the result. As for
* the magnitude <i>m</i>:
* <ul>
* <li>If <i>m</i> is infinity, it is represented by the characters
* {@code "Infinity"}; thus, positive infinity produces
* the result {@code "Infinity"} and negative infinity
* produces the result {@code "-Infinity"}.
* <li>If <i>m</i> is zero, it is represented by the characters
* {@code "0.0"}; thus, negative zero produces the result
* {@code "-0.0"} and positive zero produces the result
* {@code "0.0"}.
* <li> If <i>m</i> is greater than or equal to 10<sup>-3</sup> but
* less than 10<sup>7
</sup>, then it is represented as the
* integer part of <i>m</i>, in decimal form with no leading
* zeroes, followed by '{@code .}'
* ({@code '\u005Cu002E'}), followed by one or more
* decimal digits representing the fractional part of
* <i>m</i>.
10^-3<= float < 10^7 : 整数.小数形式(1025.35)
float < 10^-3 || float >= 10^7 :科学计数法(1.024E7)
* <li> If <i>m</i> is less than 10<sup>-3</sup> or greater than or
* equal to 10<sup>7</sup>, then it is represented in
* so-called "computerized scientific notation." Let <i>n</i>
* be the unique integer such that 10<sup><i>n</i> </sup>&le;
* <i>m</i> {@literal <} 10<sup><i>n</i>+1</sup>; then let <i>a</i>
* be the mathematically exact quotient of <i>m</i> and
* 10<sup><i>n</i></sup> so that 1 &le; <i>a</i> {@literal <} 10.
* The magnitude is then represented as the integer part of
* <i>a</i>, as a single decimal digit, followed by
* '{@code .}' ({@code '\u005Cu002E'}), followed by
* decimal digits representing the fractional part of
* <i>a</i>, followed by the letter '{@code E}'
* ({@code '\u005Cu0045'}), followed by a representation
* of <i>n</i> as a decimal integer, as produced by the
* method {@link java.lang.Integer#toString(int)}.
*
* </ul>
* </ul>
* How many digits must be printed for the fractional part of
* <i>m</i> or <i>a</i>? There must be at least one digit
* to represent the fractional part, and beyond that as many, but
* only as many, more digits as are needed to uniquely distinguish
* the argument value from adjacent values of type
* {@code float}. That is, suppose that <i>x</i> is the
* exact mathematical value represented by the decimal
* representation produced by this method for a finite nonzero
* argument <i>f</i>. Then <i>f</i> must be the {@code float}
* value nearest to <i>x</i>; or, if two {@code float} values are
* equally close to <i>x</i>, then <i>f</i> must be one of
* them and the least significant bit of the significand of
* <i>f</i> must be {@code 0}.
*
* <p>To create localized string representations of a floating-point
* value, use subclasses of {@link java.text.NumberFormat}.
*
* @param f the float to be converted.
* @return a string representation of the argument.
*/
public static String toString(float f) {
return FloatingDecimal.toJavaFormatString(f);
}
/**
* Returns a string representation of this {@code Float} object.
* The primitive {@code float} value represented by this object
* is converted to a {@code String} exactly as if by the method
* {@code toString} of one argument.
*
* @return a {@code String} representation of this object.
* @see java.lang.Float#toString(float)
*/
public String toString() {
return Float.toString(value);
}

⑧ Double

  /**
* <li>If <i>m</i> is greater than or equal to 10<sup>-3</sup> but less
* than 10<sup>
</sup>, then it is represented as the integer part of
* <i>m</i>, in decimal form with no leading zeroes, followed by
* '{@code .}' ({@code '\u005Cu002E'}), followed by one or
* more decimal digits representing the fractional part of <i>m</i>.
*
* <li>If <i>m</i> is less than 10<sup>-3</sup> or greater than or
* equal to 10<sup>
</sup>, then it is represented in so-called
* "computerized scientific notation." Let <i>n</i> be the unique
* integer such that 10<sup><i>n</i></sup> &le; <i>m</i> {@literal <}
* 10<sup><i>n</i>+1</sup>; then let <i>a</i> be the
* mathematically exact quotient of <i>m</i> and
* 10<sup><i>n</i></sup> so that 1 &le; <i>a</i> {@literal <} 10. The
* magnitude is then represented as the integer part of <i>a</i>,
* as a single decimal digit, followed by '{@code .}'
* ({@code '\u005Cu002E'}), followed by decimal digits
* representing the fractional part of <i>a</i>, followed by the
* letter '{@code E}' ({@code '\u005Cu0045'}), followed
* by a representation of <i>n</i> as a decimal integer, as
* produced by the method {@link Integer#toString(int)}.
*/
public static String toString(double d) {
return FloatingDecimal.toJavaFormatString(d);
}

⑨ String

/**
* This object (which is already a string!) is itself returned.
*
* @return the string itself.
*/
public String toString() {
return this;
}

java的toString()及包装类的实现--Integer重点学习的更多相关文章

  1. java常用类:1。包装类(以Integer类为例)2.String类 3.StringBuffer

     包装类 把八大基本数据类型封装到一个类中,并提供属性和方法,更方便的操作基本数据类型. 包装类的出现并不是用于取代基本数据类型,也取代不了. 包装类位于java.lang包中. Number 类 N ...

  2. 13-03 Java 基本类型包装类概述,Integer类,Character

    基本类型包装类概述 将基本数据类型封装成对象的好处在于可以在对象中定义更多的功能方法操作该数据.常用的操作之一:用于基本数据类型与字符串之间的转换.基本类型和包装类的对应Byte,Short,Inte ...

  3. Java基础——基本类型和包装类、基本类型和字符串之间的转换

    基本类型和包装类之间的转换 基本类型和包装类之间经常需要互相转换,以 Integer 为例(其他几个包装类的操作雷同哦): 在 JDK1.5 引入自动装箱和拆箱的机制后,包装类和基本类型之间的转换就更 ...

  4. Java开发学习--Java 中基本类型和包装类之间的转换

    Java 中基本类型和包装类之间的转换 基本类型和包装类之间经常需要互相转换,以 Integer 为例(其他几个包装类的操作雷同哦): 在 JDK1.5 引入自动装箱和拆箱的机制后,包装类和基本类型之 ...

  5. java 基本类型、包装类、字符串之间的转换

    1.基本类型和包装类 基本类型和包装类可通过自动装箱和拆箱实现. int i = 24; Integer a = new Integer(i); //手动装箱 Integer b = i; //自动装 ...

  6. Java中toString()与new String()

    Java中toString()与new String(): 1.错误演示: FileInputStream fileIn = new FileInputStream(filePath);byte[] ...

  7. 自己(转)JAVA中toString方法的作用

    JAVA中toString方法的作用 因为它是Object里面已经有了的方法,而所有类都是继承Object,所以“所有对象都有这个方法”. 它通常只是为了方便输出,比如System.out.print ...

  8. Java源码阅读的真实体会(一种学习思路)

    Java源码阅读的真实体会(一种学习思路) 刚才在论坛不经意间,看到有关源码阅读的帖子.回想自己前几年,阅读源码那种兴奋和成就感(1),不禁又有一种激动. 源码阅读,我觉得最核心有三点:技术基础+强烈 ...

  9. Java:有关try、catch和finally的学习(供自己参考)

    Java:有关try.catch和finally的学习 在看到书本的时候对finally的介绍是:不论是否在try块中产生异常,都会执行finally.当时对这句话的理解不够深,误以为在try...c ...

随机推荐

  1. [Javascript] 前端随笔

    做一个小功能时使用到的一点技术点记录下来: 1.在js中使用定时器: 这两个方法都可以用来实现在一个固定时间段之后去执行JavaScript.不过两者各有各的应用场景. 方 法 实际上,setTime ...

  2. web.config 修改数据库连接

    <connectionstrings> </database=数据库名字 ;uid = 登录数据库的名字;Password = 登录数据库的密码;/> </connect ...

  3. HDU 3584 树状数组

    Cube Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/65536 K (Java/Others)Total Submi ...

  4. Android之Tab类总结

    本文主要包括以下Tab类实现方式 FragmentTabHost+Fragment实现 传统的ViewPager实现 FragmentManager+Fragment实现 ViewPager+Frag ...

  5. 简单的form表单操作(Servlet)

    Servlet模型 [表单的处理][模型(1)] ●HTML网页 <!DOCTYPE html> <html> <head> <meta charset=&q ...

  6. redis系列

    1.redis windows下的环境搭建 2.redis初学系列

  7. Tiny PXE Server简介

    Tiny PXE Server简介Tiny PXE Server是一款小巧而功能强大的网启软件.支持DHCP TFTP HTTP BINL DNS等多个协议,支持grub4dos,pxelinux,i ...

  8. linux下mysql修改数据库账户root密码

    #先停止mysql,再运行下一句 $ mysqld_safe --user=mysql --skip-grant-tables --skip-networking & $ mysql -u r ...

  9. linux shell 终端中文乱码(转)

    方法一:修改/etc/sysconfig/i18n 文件把里面的LANG="en_US"改成 GB2312就可以了要重启一下机器不用重启的方法,直接# LANG="GB2 ...

  10. Oracle数据库的启动和关闭

    深刻理解Oracle数据库的启动和关闭 Oracle数据库提供了几种不同的数据库启动和关闭方式,本文将详细介绍这些启动和关闭方式之间的区别以及它们各自不同的功能. 一.启动和关闭Oracle数据库 对 ...