-3

I'm trying to reverse an integer array in java using Arrays.toString(reverse(arrayname) method but not able to correctly use its header file. image is here

import java.util.Scanner;
import java.util.Arrays;
import org.apache.commons.lang3;

public class ReverseDisplay 
{

    public static void main(String[] args) 
{
    int arr[]=new int[5];
    Scanner input=new Scanner(System.in);
    for(int i=0;i<5;i++)
    {
        System.out.println("Enter Element # "+(i+1));
        arr[i]=input.nextInt();
    }
        System.out.println(Arrays.toString(reverse(arr)));

    }

}

1 Answers1

2

You need to put commons-lang jar in your classpath (either in IDE or classpath param in commandline or add dependency if you use maven/gradle)

if you want to do it manually you need to download jar first: https://commons.apache.org/proper/commons-lang/download_lang.cgi

Java can import only classes that are on the classpath.

Maciej
  • 1,954
  • 10
  • 14
  • how do i put common-lang jar class path in net-beans. – Ghulam Mustafa Mar 13 '18 at 12:48
  • I don't use netbeans, but when you download from above link there will be jar file inside, and you have to add it in netbeans to classpath: https://stackoverflow.com/questions/4879903/how-to-add-a-jar-in-netbeans – Maciej Mar 13 '18 at 12:58