Java Tutorial

Steps to write a program in java

  1. Click on Start-->Programs-->accessories-->Notepad
  2. Write a program
  3. Click on SaveAs
  4. Select the Drive From down arrow under the tilte Save in
  5. Double click on directory jdk1.3
    (Or any other java directory you may have)
  6. Click on "Bin" Subdirectory
  7. Type the name of the program which should be same as the name of Class in spelling with extension 'java'(for Example 'SampleCode.java')
  8. Click on the Save
  9. The file will be saved in 'Bin' subdirectory

Steps to Compile a program in java

  1. Click on Start-->Programs-->MsDos Prompt
  2. Type "CD\Jdk1.3\bin" and press Enter
  3. Type "Javac SampleCode.java" to compile the file SampleCode.java
  4. A file with name "SampleCode.class" Gets Generated

Steps to get output of a Java Application

  1. Click on Start-->Programs-->MsDos Prompt
  2. Type "CD\Jdk1.3\bin" and press Enter
  3. Type 'Java SampleCode' to get the output of the program

Sample Application Program

Output of The Program

(In Red Rectangle)


Sample Applet Program

File name : SimpleApplet.java

import java.awt.*;
import java.applet.*;
public class SimpleApplet extends Applet
{
	public void paint(Graphics g)
	{
		g.drawString("Welcome to the World of Applets",20,20);
		g.drawString("First Java Applet",40,40);
	}
	
}

Sample Applet HTML code

File name : App.html

<HTML>
<applet code = "SimpleApplet" Width = 190 height =50>
</applet>
</HTML>

Output of The Program

(In Rectangle)


Other Sample Programs


Other Attractions
Search Engine
Right Time
Calorie Burning
Jokes Section
Quotes
Learn Science
Recipies
Ice Cream
Tic-Tac
Typing Test
Fun
Monthly Calendar
Yearly Calendar
Java Tutorial
Home Remedies
Calorie Count
Exact age

Thanks for Visiting us

Let us Return to Home page
Home