Type the programs in NOTEPAD or DOS prompt itself, for Consol Application.
Type in NETBEANS or ECLIPSE for Window Application.
Here after , I am just typing the programs only..to know more about it , refer
Type in NETBEANS or ECLIPSE for Window Application.
Here after , I am just typing the programs only..to know more about it , refer
Introduction to JAVA
before doing any JAVA Programs.
***********************************************************************************************
import java.io.*;
public class array 
{
   public static void main(String args[]) 
    {
        int a[]=new int[20];
        int i,n;
        try
        {
            DataInputStream x=new DataInputStream(System.in);
            System.out.println("Enter limit value for array");
            n=Integer.parseInt(x.readLine());
            System.out.println("Enter array elements :");
            for(i=0;i<n;i++)
            {
                a[i]=Integer.parseInt(x.readLine());
            }
            System.out.println("array elements are :");
            for(i=0;i<n;i++)
            {
                System.out.println(a[i]);
            }
        }
        catch(Exception e)
        {
        }
    }      
}    
=========================================================================
Output :
Output :
 
 
No comments:
Post a Comment