//package com.nowjava;/** from 时 代 J a v a 公 众 号 - N o w J a v a . c o m**/
import java.lang.reflect.Array;
public class Main {
public static void main(String[] argv) throws Exception {
Object object = "nowjava.com";
System.out.println(convertToArray(object));
}
/**
* Creates an array with a single object as component.
* If the specified object is an array, it will be returned
* unchanged. Otherwise an array with the specified object
* as the single element will be returned.
* @param object the object
* @return the corresponding array
*/
public static Object convertToArray(Object object) {
if (object.getClass().isArray())
return object;
/**代码未完, 请加载全部代码(NowJava.com).**/
本文系作者在时代Java发表,未经许可,不得转载。如有侵权,请联系nowjava@qq.com删除。