I am pretty new to java and I am trying to do some java involving nested classes and I am running it in Matlab
. So I have my innerclass and my outerclass and I am trying to create an instance of this new class which takes two java.lang.Objects
as it's constructor but when I try to do this I get an error and it says I am trying to pass through this Ljava.lang.Object
as opposed to a java.lang.Object. Researched a little about this about how it's the encoded name but I don't really understand. Any help would be appreciated, my code (from Matlab
) is below!
>> p = innerclass.getConstructors();
>> p(1)
ans =
public innerclassName(java.lang.Object, java.lang.Object)
>> k=javaArray('java.lang.String',3);
>> k(1)=java.lang.String('a');
>> k(2)=java.lang.String('b');
>> k(3)=java.lang.String('c');
>> v=javaArray('java.lang.Integer',3,2);
>> v(1,1) = java.lang.Integer(1);
>> v(2,1) = java.lang.Integer(2);
>> v(3,1) = java.lang.Integer(3);
>> v(1,2) = java.lang.Integer(4);
>> v(2,2) = java.lang.Integer(5);
>> v(3,2) = java.lang.Integer(6);
>> o=[java.lang.Object();java.lang.Object()];
>> o(1) = k;
>> o(2) = v;
>> o.getClass()
ans =
class [Ljava.lang.Object;
>> types=javaArray('java.lang.Class',2) ;
>> types(1)=o.getClass();
>> types(2)=o.getClass();
>> in1 = innerclass.getConstructor(types).newInstance(o)
??? Java exception occurred:
java.lang.NoSuchMethodException: innerclassName.<init>([Ljava.lang.Object;, [Ljava.lang.Object;)