Samual Sam has Published 2310 Articles

How to find Min/Max numbers in a java array?

Samual Sam

Samual Sam

Updated on 07-Oct-2023 02:52:33

31K+ Views

You can find the minimum and maximum values of an array using for loops −ExampleLive Demopublic class MinAndMax {    public int max(int [] array) {       int max = 0;             for(int i=0; imax) {             max = array[i];          }       }       return max;    }    public int min(int [] array) {       int min = array[0];             for(int i=0; i

Convert a String to Uppercase in C

Samual Sam

Samual Sam

Updated on 04-Oct-2023 14:05:42

35K+ Views

Here is the program to convert a string to uppercase in C language,Example#include #include int main() {    char s[100];    int i;    printf("Enter a string : ");    gets(s);    for (i = 0; s[i]!='\0'; i++) {       if(s[i] >= 'a' && s[i] = 'a' && s[i]

Array Copy in Java

Samual Sam

Samual Sam

Updated on 13-Sep-2023 15:09:03

30K+ Views

Array in Java can be copied to another array using the following ways.Using variable assignment. This method has side effects as changes to the element of an array reflects on both the places. To prevent this side effect following are the better ways to copy the array elements.Create a new ... Read More

Check if a Java ArrayList contains a given item or not

Samual Sam

Samual Sam

Updated on 13-Sep-2023 13:01:11

36K+ Views

The java.util.ArrayList.contains() method can be used to check if a Java ArrayList contains a given item or not. This method has a single parameter i.e. the item whose presence in the ArrayList is tested. Also it returns true if the item is present in the ArrayList and false if the ... Read More

How to find the index of an item in a C# list in a single step?

Samual Sam

Samual Sam

Updated on 09-Sep-2023 23:28:21

40K+ Views

To get the index of an item in a single line, use the FindIndex() and Contains() methods.int index = myList.FindIndex(a => a.Contains("Tennis"));Above, we got the index of an element using the FindIndex(), which is assisted by Contains() method for that specific element.Here is the complete code −Example Live Demousing System; using ... Read More

How to convert string to array of integers in java?

Samual Sam

Samual Sam

Updated on 06-Sep-2023 12:59:19

44K+ Views

You can convert a String to integer using the parseInt() method of the Integer class. To convert a string array to an integer array, convert each element of it to integer and populate the integer array with them.Example Live Demoimport java.util.Arrays; public class StringToIntegerArray { public static void ... Read More

Java program to find the 2nd largest number in an array

Samual Sam

Samual Sam

Updated on 02-Sep-2023 15:09:09

83K+ Views

To find the second largest element of the given array, first of all, sort the array.Sorting an arrayCompare the first two elements of the arrayIf the first element is greater than the second swap them.Then, compare 2nd and 3rd elements if the second element is greater than the 3rd swap ... Read More

How to Create a Multi-line Text Input (Text Area) In HTML?

Samual Sam

Samual Sam

Updated on 02-Sep-2023 13:59:12

53K+ Views

To create a multi-line text input, use the HTML tag. You can set the size of a text area using the cols and rows attributes. It is used within a form, to allow users to input text over multiple rows.Here are the attributes of tag −AttributeValueDescriptionautofocusautofocusSpecifies that on ... Read More

How to pass Arrays to Methods in Java?

Samual Sam

Samual Sam

Updated on 02-Sep-2023 13:52:53

65K+ Views

You can pass arrays to a method just like normal variables. When we pass an array to a method as an argument, actually the address of the array in the memory is passed (reference). Therefore, any changes to this array in the method will affect the array.Suppose we have two ... Read More

Even in Offline Mode, You Can browse Using Google Chrome

Samual Sam

Samual Sam

Updated on 03-Mar-2023 11:50:12

2K+ Views

In Google Chrome, when you open any page, it instantly connects to the internet and fetches you the latest version of the page from the server and then it displays on your screen, be it mobile or desktop. In case if there is a problem with the internet connection, then ... Read More

Advertisements