Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class Main {
    public static void main(String[] args) {
        List<String> list = new ArrayList<>();
        list.add("Java");
        list.add("R");
        list.add("CSS");
        list.add("XML");

        Collections.sort(list);
        System.out.println("List: " + list);

        int index = Collections.binarySearch(list, "CSS");
        System.out.println("CSS in List  is at " + index);

        index = Collections.binarySearch(list, "Javascript");
        System.out.println("Javascript in List is  at " + index);

    }
}