You write the program in it's source code. Ie

Code:
public class PrintNumbers
{
  public static void main( String args[] )
  {
    for( int i = 0; i < 10; i++ )
    {
      System.out.println( i );
    }
  }
}
Ok. Now you have some source code. You can save this source code as a text file or as the source code itself (in this case, PrintNumbers.java or something like that) and view it in text editors. Then you can save it to your disk.

The thing is, the source code will not do anything by itself. You must first compile it. In this case I would go:
Code:
javac PrintNumbers.java
java PrintNumbers
Ok. Now in my case you have a java class which I could use in other parts of my program (in this case not really but that's a whole other story). If you use C++ or VB, you can make [i].exe[/o] files that are programs that you can run the program on your computer by double clicking on it, etc.

Basically, if you want to learn what source code is, what it does etc, go learn a computer language such as:
Java
C/C++
Visual Basic
etc.

A good place to learn is Planet Source Code. Good luck!