Arushi has Published 152 Articles

Find the maximum element of a Vector in Java

Arushi

Arushi

Updated on 30-Jun-2020 08:20:22

825 Views

The maximum element of a Vector can be obtained using the java.util.Collections.max() method. This method contains a single parameter i.e. the Vector whose maximum element is determined and it returns the maximum element from the Vector.A program that demonstrates this is given as follows −Example Live Demoimport java.util.Collections; import java.util.Vector; public ... Read More

Perform Binary Search in Java using Collections.binarySearch

Arushi

Arushi

Updated on 30-Jun-2020 08:14:53

222 Views

Binary Search can be performed in Java using the method java.util.Collections.binarySearch(). This method requires two parameters i.e. the list in which binary search is to be performed and the element that is to be searched. It returns the index of the element if it is in the list and returns ... Read More

Class with a constructor to initialize instance variables in Java

Arushi

Arushi

Updated on 30-Jun-2020 08:06:52

10K+ Views

A class contains a constructor to initialize instance variables in Java. This constructor is called when the class object is created.A program that demonstrates this is given as follows −Example Live Democlass Student {    private int rno;    private String name;    public Student(int r, String n) {     ... Read More

Print a Vector in a comma-delimited list, in index order and surrounded by square brackets ([]) in Java

Arushi

Arushi

Updated on 30-Jun-2020 08:04:49

338 Views

A Vector can be printed in a comma-delimited list, in index order and surrounded by square brackets ([]) by simply using System.out.println() along with the Vector object.A program that demonstrates this is given as follows −Example Live Demoimport java.util.Vector; public class Demo {    public static void main(String args[]) {   ... Read More

How to reverse of integer array in android listview?

Arushi

Arushi

Updated on 26-Jun-2020 14:02:53

305 Views

This example demonstrate about How to reverse of integer array in android listview.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml         ... Read More

How to print exception messages in android?

Arushi

Arushi

Updated on 26-Jun-2020 13:06:25

1K+ Views

This example demonstrate about How to print exception messages in android.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.         In ... Read More

How to insert integer array in android listview?

Arushi

Arushi

Updated on 26-Jun-2020 13:05:17

672 Views

This example demonstrate about How to insert integer array in android listview.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml         In ... Read More

How to check existence of an element in android listview?

Arushi

Arushi

Updated on 26-Jun-2020 12:50:35

466 Views

This example demonstrate about How to check existence of an element in android listview.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.                 In the ... Read More

Factory method to create Immutable List in android?

Arushi

Arushi

Updated on 26-Jun-2020 12:48:02

129 Views

This example demonstrate about Factory method to create Immutable List in android.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.         ... Read More

How to check edit text values are Anagram or Not in android?

Arushi

Arushi

Updated on 26-Jun-2020 12:44:44

88 Views

This example demonstrate about How to check edit text values are Anagram or Not in android.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml. ... Read More

Advertisements