#include "Date.h" #include using namespace std; JNIEXPORT void JNICALL Java_Date_printDate(JNIEnv * env, jobject ths) { jint m, d, y; jclass cls = env->GetObjectClass( ths ); jfieldID id_month = env->GetFieldID( cls, "month", "I" ); jfieldID id_day = env->GetFieldID( cls, "day", "I" ); jfieldID id_year = env->GetFieldID( cls, "year", "I" ); m = env->GetIntField( ths, id_month ); d = env->GetIntField( ths, id_day ); y = env->GetIntField( ths, id_year ); std::cout << m << "/" << d << "/" << y << endl; }