转自:http://blog.csdn.net/ld422586546/article/details/9707997 Java中父类强制转换成子类的原则:父类型的引用指向的是哪个子类的实例,就能转换成哪个子类的引用. 例: public class Test { public static void main(String[] args) { Person person = new Boy(); Boy boy = (Boy) person; boy.eat(); } } class P…
040_字符串连接符 package test_package; /** * 字符串运算符 * @author * */public class TestOperator05 { public static void main(String[] args) { String a = "3"; int b = 4; int c = 5; char d = 'a'; System.out.println(a+b+c);//因为3是字符串,后面都是字符串连接 System.out.print…