All pastes #362947 Raw Edit

RYAN MacArthur

public java v1 · immutable
·published 2007-02-19 04:01 UTC
rendered paste body
////  urlloader.java//  urlloader////  Created by Ryan MacArthur on 2/18/07.//  Copyright (c) 2007 __MyCompanyName__. All rights reserved.//import java.net.*;import java.io.*;public class urlloader {  public static void main (String args[]) throws Exception {	boolean testobj;    // Create an array of URLs     // From directory name specified as args[0]    URL urlList[] = {new File(args[0]).toURL()};	URL urlList2[] = {new File(args[0]).toURL()};    // Create a URLClassLoader    ClassLoader loader1 = new URLClassLoader(urlList);	ClassLoader loader2 = new URLClassLoader(urlList2);    // Load class from class loader    // Use args[1] as class name    Class c = loader1.loadClass (args[1]);	Class d = loader1.loadClass (args[1]);	Class e = loader2.loadClass (args[1]);    	// Create an instance of the class just loaded    Object tester1 = c.newInstance();	Object tester2 = d.newInstance();	Object tester3 = e.newInstance();	System.out.println(loader1.hashCode());	System.out.println(loader2.hashCode());	System.out.println(d.hashCode());	System.out.println(e.hashCode());	System.out.println(tester1.hashCode());	System.out.println(tester3.hashCode());	testobj = tester3.equals(tester1);	if(!testobj)		System.out.println("Objects are not equal");  }}