请看一下代码 import java.util.*; class book{ static int c = null; } public static void main(String[] args){ Book book1 = new book(); Book book2 = new book(); book1.c = 6; book2.c = 4; book1 = book2; } 以上,当book1和book2两个对象之间相互赋值的时候,那么当我们调用Book.c的时候,我们就会发现bo
第一节 String类型的方法参数 运行下面这段代码,其结果是什么? package com.test; public class Example { String str = new String("good"); char[] ch = { 'a', 'b', 'c' }; public static void main(String[] args) { Example ex = new Example(); ex.change(ex.str, ex.ch); System.out
package mypack; import java.io.Serializable; import java.net.InetAddress; /** * 唯一主键生成办法.从Hibernate中提取出来. */ public class UUIDGenerator { private static final int IP; public static int IptoInt( byte[] bytes ) { int result = 0; for (int i=0; i<4; i++)
自从JDK7更新之后,新增了二进制变量的表示,支持将整数类型用二进制来表示,用0b开头: 例如: byte b= (byte) 0b1000_0001; short s = (short) 0b1000_0000_0000_0001; 新手在这个时候会遇到一个问题,为啥byte b=0b100_00001会报错(cannot convert from int to byte) 而short b=0b100_00001又不会呢?既然java底层默认0b100_00001是int类型,为什么shor