Discussion Board
Go to the previous messageThere are no next messages
Current Forum: Homework 5 General Forum
Date: Fri Nov 16 2001 9:05 am
Author: Ghosh, Debmallo S. <dsghosh@cmu.edu>
Subject: Re: Website address consistency

The URL class is smart enough to detect that the two are the same URL. A quick test will prove this. Just put the following code into a program (you might need to add try/catch blocks or something):

import java.net.*;
import java.io.*;

public class TestClass {

public static void main( String[] args ) {
URL test = new URL( "http://www.GoOgLe.com" );
URL test2 = new URL( "http://www.google.com" );
System.out.println( test1 );
System.out.println( test2 );
System.out.println( test1.equals( test2 ) );
}
}

The output I got, and you will get, should be:

http://www.GoOgLe.com
http://www.google.com
true

Hope this helps.
Post response

Go to the previous messageThere are no next messages
Current Thread Detail:
Website address consistency      Costa, Christopher J.      Wed Nov 14 2001 2:41 pm       
Re: Website address consistency      Ghosh, Debmallo S.      Fri Nov 16 2001 9:05 am       

Back to previous screen