/////// File: myAverage.C /////// // Java Native Method implemented in C++ #include "myAverage.h" #include void display(int a, int b) // C++ code { printf("In C++ \n"); int c = (a+b)/2; printf("Ave= %d\n", c); // cout << "Ave= by cout" << c << endl; do not use this } class Foo { public: Foo(int a, int b) { i =a; j=b; } void show() { display(i, j); } private: int i, j; }; // extern "C" code JNIEXPORT void JNICALL Java_Average_myAverage(JNIEnv *env, jclass cls) { Foo obj = Foo(2,5); obj.show(); int a = 7, b = 11; display(a, b); }