package wbb.java.JavaObject; /** * Created with IntelliJ IDEA. * User: wbb * Date: 14-7-17 * Time: 下午4:26 * To change this template use File | Settings | File Templates. */ public class MulParams { public static void main(String[] args) { mulFun("篮球", "足球"); } public static void mulFun(String... ballName) { for(String name : ballName) { System.out.println(name); } } }
package wbb.java.JavaObject; /** * Created with IntelliJ IDEA. * User: wbb * Date: 14-7-21 * Time: 上午9:31 * To change this template use File | Settings | File Templates. */ public class OverWrite { public static void main(String[] args) { B b = new B(); b.test(); } } class A { public String name = "wbb"; public void test() { System.out.println("父类test方法"); } } class B extends A { public void test() { System.out.println(super.name); super.test(); } }
package wbb.java.JavaObject; /** * Created with IntelliJ IDEA. * User: wbb * Date: 14-7-23 * Time: 上午9:31 * To change this template use File | Settings | File Templates. */ public class ToString { public static void main(String[] args) { Animal animal = new Animal("忠犬八公"); System.out.println(animal); } } class Animal { private String name; public Animal(String name) { this.name = name; } // public String toString() { // return "这条狗的名字为" + name; // } }
原文地址:http://blog.csdn.net/w_basketboy24/article/details/37909495