C++ Programming
12-11-2009, 11:51 PM
below is C++ code
jmethodID mid;j
class cls = env->FindClass( "test/MyTest");
mid = env->GetMethodID(cls, "append","(Ljava/lang/String;I)Ljava/lang/String;");
mid=env->GetMethodID(cls,"HelloWord","()Ljava/lang/String;");
below is display by javap
public test.MyTest(java.lang.String);
Signature: (Ljava/lang/String;)V
public java.lang.String HelloWord();
Signature: ()Ljava/lang/String;
public java.lang.String append(java.lang.String, int);
Signature: (Ljava/lang/String;I)Ljava/lang/String;
below is java code:
public String HelloWord()
{ System.out.println("JAVA-CLASS:MyTest method:HelloWord:" +helloword);
return helloword;}
public String append(String str, int i) { return str + i; }
notice: the class has been found successfully, and the construct function 's id is not return 0
question:why the other methods’s id always return 0??
jmethodID mid;j
class cls = env->FindClass( "test/MyTest");
mid = env->GetMethodID(cls, "append","(Ljava/lang/String;I)Ljava/lang/String;");
mid=env->GetMethodID(cls,"HelloWord","()Ljava/lang/String;");
below is display by javap
public test.MyTest(java.lang.String);
Signature: (Ljava/lang/String;)V
public java.lang.String HelloWord();
Signature: ()Ljava/lang/String;
public java.lang.String append(java.lang.String, int);
Signature: (Ljava/lang/String;I)Ljava/lang/String;
below is java code:
public String HelloWord()
{ System.out.println("JAVA-CLASS:MyTest method:HelloWord:" +helloword);
return helloword;}
public String append(String str, int i) { return str + i; }
notice: the class has been found successfully, and the construct function 's id is not return 0
question:why the other methods’s id always return 0??