follow this link to acquire the knowledge hub...
Soon i will let you explain .... the easy way....
Simple Programme to add two no , input must be through keyboard :
---------------------------------------
import java.io.*;
//imports java.io class
/** Adds 2 integers given by the user, then prints out the sum. */
class Add2number
{
//main(): application entry point
public static void main(String[] args) throws IOException
{
//set input stream
BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
//get numbers from user input
//asks user for 1st number, then converts it to an integer
System.out.print("Enter first integer: ");
int x = Integer.parseInt(stdin.readLine());
//asks user for 2nd number, than converts it to an integer
System.out.print("Enter second integer: ");
int y = Integer.parseInt(stdin.readLine());
//add x,y
int sum = x + y;
//Display sum of x,y
System.out.println("The sum is: " + sum);
}//ends main
}//ends addReadLine
---------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------
JAVA APPLET ---------->
DEFINITION:----
Java, as outlined above, is a grouping of objects. A "class" of objects, actually (more on that later). The Java applet is itself a fully functioning little program. It's an application, but it's a little application: An applet
To view Application On the Browser called Applet.(small application)
How to create First Programe
First open Notepad
type->
public class MyFirstApplet extends java.applet.Applet
{
public void paint(java.awt.Graphics g)
{
g.drawString("My First Applet Application",70,30);
System.out.println("My First Applet Application");
}
}
Now save it with name->javac MyFirstApplet.java
This creates the class file
MyFirstApplet.class
Now to View the output You have to build a WebPage In HTML
And Bind You applet Class file to there.
make a html file write the code here:
====================================
0 comments:
Post a Comment