Create an Object from an Array Class
- From: Z <ztuffaha@xxxxxxxxx>
- Date: Tue, 30 Oct 2007 21:33:21 -0000
I am using reflection to getmethod(methodName, Class parameters) and
invoke(object, obj[] parameters) methods from some Objects.
My problem is:
Say: I want to invoke a method that takes String[] object as parameter
(I was able to getmethod correctly). When I try to create an object
(to pass as args to invoke):
Object someObject= (Object) String[].class.newInstance();
(Note that the object is not always an instance of String[]... it
could be an instance of SomeOtherClass[])
I do get the following exception:
java.lang.InstantiationException: [Ljava.lang.String;
My question is:
Does the "[L" at the beginning and the ";" at the end have a meaning?
How can I solve this problem?
I am using IntelliJ 6.0.5.
Thanks in advance.
.
- Follow-Ups:
- Re: Create an Object from an Array Class
- From: Lasse Reichstein Nielsen
- Re: Create an Object from an Array Class
- From: Joshua Cranmer
- Re: Create an Object from an Array Class
- Prev by Date: Re: Endianness of Java Virtual Machine
- Next by Date: Re: Self contained deployment problem?
- Previous by thread: Endianness of Java Virtual Machine
- Next by thread: Re: Create an Object from an Array Class
- Index(es):
Relevant Pages
|