Notice


AWT and SWING will be covered soon !

Friday, October 16, 2009

Client Socket Program

 

package sp;

import java.io.IOException;
import java.net.Socket;
import java.net.UnknownHostException;
public class Main {

    static Socket MyClient;
  
    public static void main(String[] args)
    {
        try
        {
            MyClient = new Socket("127.0.0.1", 80);
        } catch (UnknownHostException ex)
        {
            System.out.println(ex);
        } catch (IOException ex)
        {
            System.out.println(ex);
        }

    }

}

Wednesday, October 7, 2009

How to Create a AWT Frame

 

import java.awt.Frame;

 

public class Tarr extends Frame
{

 

public Tarr() //in constuctor put all the Frame things you need
{
    this.setSize(100,100);
    this.setVisible(true);
}

 

}

 

Then in the Main Function Create a New Object of this Class