- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
To find the third largest number 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 them.Repeat this till the end of the array.After sorting an array print the third element from the end of the array.ExampleLive Demopublic class ThirdLargestNumberInAnArray { public static void main(String args[]){ int temp, size; int array[] = {10, 20, 25, 63, 96, 57}; size = array.length; for(int i = 0; i
In this article, we will understand how to print square star pattern. The pattern is formed by using multiple for-loops and print statements.Below is a demonstration of the same −InputSuppose our input is −Enter the length of a side : 8OutputThe desired output would be −The square pattern : * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ... Read More
In the field of data structure, the vector is a growable class array of a particular object. The vector class falls in the legacy class which is fully compatible with the collections. In java.util package, the List interface can use all the methods listed here. Here is the initial capacity is 10 and the general method is: Vector v = new Vector(); The compare() method accepts two parameters and then compare each other by using Java environment logic. In this article today, we will learn about the sorting process of a 2D array set across the columns. Algorithm to ... Read More
A string is a class of 'java.lang' package that stores a series of characters. Those characters are actually String-type objects. We must enclose the value of string within double quotes. Generally, we can represent characters in lowercase and uppercase in Java. And, it is also possible to convert lowercase characters into uppercase. This article aims to discuss a Java program to convert the first character of each word into uppercase in a string. Java program to Capitalize the first character of each word in a String Before making a Java program to convert the first lowercase character of a ... Read More
The number of times a word occurs in a string denotes its occurrence count. An example of this is given as follows −String = An apple is red in colour. Word = red The word red occurs 1 time in the above string.A program that demonstrates this is given as follows.Example Live Demopublic class Example { public static void main(String args[]) { String string = "Spring is beautiful but so is winter"; String word = "is"; String temp[] = string.split(" "); int count = 0; for (int i = 0; i < temp.length; i++) { if (word.equals(temp[i])) count++; } System.out.println("The string ... Read More
Java Language is one of the most used popular object - oriented programming language in present world. Class concept is one of the most important feature in Object - oriented languages. A Class is a like a blue print of an object. For example, when we want to build a house we first create a blue print of the house in other words we create a plan showing how we are going to build the house. Based on the plan we can create a number of houses. Similarly using class, we can create a number of objects. A class ... Read More
Let’s say we have the following string, that has some letters and numbers.String str = "9as78";Now loop through the length of this string and use the Character.isLetter() method. Within that, use the charAt() method to check for each character/ number in the string.for (int i = 0; i < str.length(); i++) { if (Character.isLetter(str.charAt(i))) count++; }We have set a count variable above to get the length of the letters in the string.Here’s the complete example.Example Live Demopublic class Demo { public static void main(String []args) { String str = "9as78"; int count ... Read More
Introduction In Java, a list is an ordered collection of elements that allows duplicates. Sometimes, we may need to combine two lists into one list. Concatenating two lists means joining the elements of the two lists to form a new list containing all the elements of both lists. There are various ways to concatenate two lists in Java, including using loops, streams, and built-in methods. In this context, we will explore different approaches to concatenate two lists in Java. One approach is to use the addAll() method provided by the List interface. This method adds all the elements of one ... Read More
To convert ASCII to string, use the toString() method. Using this method will return the associated character.Let’s say we have the following int value, which works as ASCII for us.int asciiVal = 89;Now, use the toString() method.String str = new Character((char) asciiVal).toString();Example Live Demopublic class Demo { public static void main(String []args) { int asciiVal = 87; String str = new Character((char) asciiVal).toString(); System.out.println(str); } }OutputW
The RSA name is given by their inventors which is used to encrypt the text with high security. The RSA technique is one of the most used techniques to encrypt text, as it is the asymmetric encryption algorithm. It encrypts the text by utilizing the mathematical properties of the prime numbers. In the RSA algorithm, the sender and receiver have private keys. Also, a common public key exists, which the sender shares with the receiver. The sender encrypts the plain text using their own public and private key, and the receiver decrypts the message using their private and public ... Read More
To Continue Learning Please Login
Login with Google