java 多参实现

package com.northeasttycoon.monitor.service;

import static java.lang.System.out;

/**
 * Created by northeasttycoonon 2015/9/20.
 */
public class ServerMessager {

    public void print(String... args) {
        for (int i = 0; i < args.length; i++) {
            out.println(args[i]);
        }
    }

    public void print(String test) {
        out.println("------dddd----");
    }

    public static void main(String[] args) {
        ServerMessager test = new ServerMessager();
        test.print("northeasttycoon");
        test.print("northeasttycoon", "northeasttycoon");
    }
}

 

posted @ 2016-09-27 09:38  东北大亨  阅读(305)  评论(0编辑  收藏  举报