Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import org.apache.commons.lang.ArrayUtils;

public class Main {
    public static void main(String[] args) {
        String[] colours = { "Red", "Orange", "Yellow", "Green", "Blue", "Violet", "Orange", "Blue" };

        boolean contains = ArrayUtils.contains(colours, "Blue");
        System.out.println("Contains Blue? " + contains);

        int indexOfYellow = ArrayUtils.indexOf(colours, "Yellow");
        System.out.println("indexOfYellow = " + indexOfYellow);
        int indexOfOrange = ArrayUtils.indexOf(colours, "Orange");
        System.out.println("indexOfOrange = " + indexOfOrange);
        int lastIndexOfOrange = ArrayUtils.lastIndexOf(colours, "Orange");
        System.out.println("lastIndexOfOrange = " + lastIndexOfOrange);
    }
}