标签:ati gets 类型 get puts getch highlight put etc
一、ByteBuffer类型化的put与get方法
/** * ByteBuffer类型化的put与get方法 */ public class NioTest5 { public static void main(String[] args) { ByteBuffer buffer = ByteBuffer.allocate(64); buffer.putInt(5); buffer.putLong(500000000L); buffer.putDouble(13.456); buffer.putChar(‘你‘); buffer.putShort((short) 3); buffer.flip(); System.out.println(buffer.getInt()); System.out.println(buffer.getLong()); System.out.println(buffer.getDouble()); System.out.println(buffer.getChar()); System.out.println(buffer.getShort()); } }
put和get的类型要一致。如第一个是putInt, 输出的使用第一个要用getInt。
标签:ati gets 类型 get puts getch highlight put etc
原文地址:https://www.cnblogs.com/linlf03/p/11337082.html