The problem with arithmetic

The night watchman had received a pound too much in his pay packet but didn't mention it to his boss. But his boss found out and deducted it the following pay day. "Hey," said the watchman, "I am a pound short this week." "Well, you didn't say anything when you were paid a pound too much last time I noticed." "No," replied the watchman, "I can overlook one mistake but when it happens twice, it's time to speak up."



Promises are meant to be broken

A man received a letter from a bunch of kidnappers, which said, "If you don't promise to send us US $100,000, we promise you we will kidnap your wife." The poor man instantly wrote back, "I am afraid I can't keep my promise, but I hope you will keep yours."

Chapter 3 Java Native Interface
//Entry point
int APIENTRY WinMain(HINSTANCE hInstance, 
	HINSTANCE hPrevInstance, 
		 LPSTR lpCmdLine, int nCmdShow)
{
	JNIEnv* env;
	JavaVMOption options[1];
	JavaVM* jvm;
	JavaVMInitArgs vm_args;
	long status;
	jclass cls;
	jmethodID mainId;
	options[0].optionString = "-Djava.class.path=.";
	
	memset(&vm_args, 0, sizeof(vm_args));
	vm_args.version = JNI_VERSION_1_2;
	vm_args.nOptions = 1;
	vm_args.options = options;

	/* Create the JVM */
	status = JNI_CreateJavaVM( 
	   &jvm, (void**)&env, &vm_args ); 

	//Error
	if( status == JNI_ERR )
		return 1;

	/*load the class containing 
	the main() method */
	cls = (*env)->FindClass( env, MAIN_CLASS );

	/* find the main() method */
	mainId = (*env)->GetStaticMethodID(
		env, cls, "main", "([Ljava/lang/String;)V");

	/* call main() */
	(*env)->CallStaticVoidMethod(env, cls, mainId, 0); 

	/* kill the JVM */
	(*jvm)->DestroyJavaVM( jvm ); 

	return 0;
}
Contents         Top                              Move to the preceding page Move to the next page
© 2001 www.universalteacher.com. All rights reserved