Largest among all in Java

Table of Contents

Compile and Run the following code with Command-Prompt Or download Notepad++.

For Compilation javac

For Execution java Sample

import java.util.Scanner;
class Sample
  public static void main(String[] args)
    int a[];
    int max,i,n;
    Scanner sc = new Scanner(;
    System.out.println("Enter the number: ");
    n = sc.nextInt();
    a = new int[n];
    System.out.println("The Largeest of all is "+max);
    static int maximum(int[] a,int n)
      int i;
      int m = 0;
      for(i = 0;i<n;i++)
          m = a[i];
    return m;
Previous Odd OR Even Program in Java
Next Prime Number in Java

Leave a Reply