数据类型转换一般分为三种: 在java中整型,实型,字符型视为简单数据类型,这些数据类型由低到高分别为:(byte,short,char--int-long-float-double) 简单数据类型之间的转换又可以分为: a.低级到高级的自动类型转换 b.高级到低级的强制类型转换 c.包装类过度类型转换 下面分别来看下这几种转换: 第一种:自动类型转换 低级变量可以直接转换为高级变量,如: byte b; int i = b; long l = b; float f = b; double d
public byte[] getBytes(Charset charset) Encodes this String into a sequence of bytes using the given charset, storing the result into a new byte array. This method always replaces malformed-input and unmappable-character sequences with this charset'