Java Tutorial

 
 
 
 
/* <applet code=\"URLDemo\"   height=100 width=400> </applet> */

import java.awt.*;
import java.applet.*;
import java.net.*;

public class URLDemo extends Applet
{
      public void paint(Graphics g){
          String msg;

          URL url=getCodeBase();
          msg = \"Code Base : \"+url.toString();
          g.drawString(msg,10,20);

          url=getDocumentBase();
          msg=\"Document Base : \"+url.toString();
          g.drawString(msg,10,40);
    }
}

 
 
Didn't find what you were looking for? Find more on An applet program to give demo of getDocumentBase() and getCodeBase() methods