- 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
Found 75 Articles for Campus Interview
601 Views
In this article, we will understand how to check if a string is empty or null. String is a datatype that contains one or more characters and is enclosed in double quotes(“ ”).Below is a demonstration of the same −Suppose our input is −Input string: nullThe desired output would be −The string is a null stringAlgorithmStep 1 - START Step 2 - Declare a string namely input_string. Step 3 - Define the values. Step 4 - Using an if-loop, compute input_string == null. If true, the string is null, else the string is not null. Step 5 - Display the ... Read More
227 Views
In this article, we will understand how to remove all whitespaces from a string. String is a datatype that contains one or more characters and is enclosed in double quotes(“ ”).Below is a demonstration of the same −Suppose our input is −Input string: Java programming is fun to learn.The desired output would be −The string after replacing white spaces: Javaprogrammingisfuntolearn.AlgorithmStep 1 - START Step 2 - Declare two strings namely String input_string and result. Step 3 - Define the values. Step 4 - Use the function replaceAll("\s", "") to replaces all the white spaces with blank spaces. Step 5 - ... Read More
440 Views
In this article, we will understand how to convert collection into array. The Collection is a framework that provides architecture to store and manipulate the group of objects. Java Collections can achieve all the operations that you perform on a data such as searching, sorting, insertion, manipulation, and deletion.Below is a demonstration of the same −Suppose our input is −Input list: [Java , program , is , fun]The desired output would be −The result after converting to an array is: Java program is funAlgorithmStep 1 - START Step 2 - Declare a list namely input_list, a string array namely result_string. ... Read More
182 Views
In this article, we will understand how to shuffle the elements of a collection. The Collection is a framework that provides architecture to store and manipulate the group of objects. Java Collections can achieve all the operations that you perform on a data such as searching, sorting, insertion, manipulation, and deletion.Below is a demonstration of the same −Suppose our input is −Input list: [Java, program, is, fun, and, easy]The desired output would be −The shuffled list is: [is, easy, program, and, fun, Java]AlgorithmStep 1 - START Step 2 - Declare an arraylist namely input_list. Step 3 - Define the values. ... Read More
976 Views
In this article, we will understand how to format time in AM-PM format. A formatting string describes how a date/time values should be read and written from(to) string representation (flat files, human readable output, etc.)Below is a demonstration of the same −Suppose our input is −Current date: Thu Mar 17 16:04:31 IST 2022The desired output would be −The current Time in AM/PM format is : 04.04 pmAlgorithmStep 1 - START Step 2 - Declare a date object namely current_date that fetches the current date and time. Step 3 - Define the values. Step 4 - Declare an object ‘formatTime’ of ... Read More
97 Views
In this article, we will understand how to get the size of the collection. The Collection is a framework that provides architecture to store and manipulate the group of objects. Java Collections can achieve all the operations that you perform on a data such as searching, sorting, insertion, manipulation, and deletion.Below is a demonstration of the same −Suppose our input is −Input list: [100, 180, 250, 300]The desired output would be −The size of the list = 4AlgorithmStep 1 - START Step 2 - Declare a list namely input_list. Step 3 - Define the values. Step 4 - Using the ... Read More
508 Views
In this article, we will understand how to compare elements in a collection. The Collection is a framework that provides architecture to store and manipulate the group of objects. Java Collections can achieve all the operations that you perform on a data such as searching, sorting, insertion, manipulation, and deletion.Below is a demonstration of the same −Suppose our input is −Input list: [300, 500, 180, 450, 610]The desired output would be −Min value of our list : 180 Max value of our list : 610AlgorithmStep 1 - START Step 2 - Declare a list namely input_list Step 3 - Define ... Read More
488 Views
In this article, we will understand how to print a collection. The Collection is a framework that provides architecture to store and manipulate the group of objects. Java Collections can achieve all the operations that you perform on a data such as searching, sorting, insertion, manipulation, and deletion.Below is a demonstration of the same −Suppose our input is −Run the programThe desired output would be −The Elements of the collection are: Language : Java | Language_id : 101 Language : Scala | Language_id : 102 Language : Python | Language_id : 103 Language : Mysql | Language_id : 104AlgorithmStep 1 ... Read More
538 Views
In this article, we will understand how to lookup enum by string value. An enum is a special "class" that represents a group of constants (unchangeable variables, like final variables).Below is a demonstration of the same −Suppose our input is −The string is to lookup is: JavaThe desired output would be −The result is: JAVAAlgorithmStep 1 - START Step 2 - Declare a string namely input_string, an object of Languages namely result. Step 3 - Define the values. Step 4 - Use the function .valueOf() to fetch the string from the enum function. Step 5 - Display the result Step ... Read More
157 Views
In this article, we will understand how to implement switch statement on strings. The switch expression is evaluated once. The value of the expression is compared with the values of each case. String is a datatype that contains one or more characters and is enclosed in double quotes(“ ”).Below is a demonstration of the same −Suppose our input is −Input string: JavaThe desired output would be −Using siwtch cases: We shall use Java for our codingAlgorithmStep 1 - START Step 2 - Declare a string namely input_string. Step 3 - Define the values. Step 4 - Define a stwtch statement ... Read More