
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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 67 Articles for Campus Interview

341 Views
In this article, we will understand how to join two lists. The ArrayList class extends AbstractList and implements the List interface. ArrayList supports dynamic arrays that can grow as needed.Array lists are created with an initial size. When this size is exceeded, the collection is automatically enlarged. When objects are removed, the array may be shrunk.Below is a demonstration of the same −Suppose our input is −First list is defined as: [Java, Python] Second list: [Mysql, Redshift]The desired output would be −The list after joining two strings: [Java, Python, Mysql, Redshift]AlgorithmStep 1 - START Step 2 - Declare two lists ... Read More

452 Views
The Linked List in a Java is a data structure that is used for storing data in linear order. It has a series of node where each node contains two parts: data and a reference to the next node in the list. The first node is called the head and the last node is called the tail. In this article, we will learn how to access elements from a LinkedList in Java. Following are the ways to access elements from a LinkedList in Java: Using get() Method Using getFirst() Methods Using getLast() Method Accessing Elements from a LinkedList ... Read More

805 Views
A list is a collection in Java which is used for storing group of elements. It is an ordered collection which also allows to store duplicate elements. A String is a sequence of characters which is used for representing text in Java. Here, in this article, we are given a list of strings, we have to convert it into a comma-separated string in Java using different approaches. To understand this problem, consider the following input-output scenarios: Scenario 1 Input: ["Apple", "Banana", "Mango", "Orange"] Output: Apple, Banana, Mango, Orange Scenario 2 Input: ["Red", "Green", "Blue"] Output: ... Read More

295 Views
In this article, we will understand how to differentiate == operator and equals() method in Java. The == (equal to) operator checks if the values of two operands are equal or not, if yes then the condition becomes true. The equals() method compares this string to the specified object. The result is true if and only if the argument is not null and is a String object that represents the same sequence of characters as this object. Below is a demonstration of the same − Suppose our input is − The first string: abcde The second string: 12345 The ... Read More

418 Views
In this article, we will understand how to remove a sub-list from a list. A list is an ordered collection that allows us to store and access elements sequentially. It contains the index-based methods to insert, update, delete and search the elements. It can also have the duplicate elements.Below is a demonstration of the same −Suppose our input is −Input list: [Java, Programming, Is, Fun]The desired output would be −The list after removing a sublist is: [Java, Programming]AlgorithmStep 1 - START Step 2 - Declare an AbstractList namely input_list. Step 3 - Add the values to the list. Step 4 ... Read More

2K+ Views
In this article, we will understand how to iterate through each character of the string using Java. The string is a datatype that contains one or more characters and is enclosed in double quotes (“ ”). Char is a datatype that contains an alphabet an integer or a special character. Problem Statement Write a program to Iterate through each character of the string. Below is a demonstration of the same − Input The string is defined as: Java Program Output The characters in the string are: J, a, v, a, , P, r, o, g, r, a, m, Different approaches ... Read More

2K+ Views
On clearing the StringBuffer object, all the characters from the buffer will be removed. In this article, we will write Java program to clear the StringBuffer. StringBuffer is a peer class of String that provides much of the functionality of strings. But, String represents fixed-length, immutable character sequences while StringBuffer represents mutable character sequences. Example Scenario: Input: obj = Java Program Output: res = The result will be an empty StringBuffer object. Using delete() method The StringBuffer class of java.lang package provides a method named delete() to clear the StringBuffer. This method accepts start and end indices ... Read More

746 Views
In this article, we will understand how to create random strings. 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 −The size of the string is defined as: 10The desired output would be −Random string: ink1n1dodvAlgorithmStep 1 - START Step 2 - Declare an integer namely string_size, a string namely alpha_numeric and an object of StringBuilder namely string_builder. Step 3 - Define the values. Step 4 - Iterate for 10 times usinf a for-loop, generate a random value using the function Math.random() ... Read More

2K+ Views
In this article, we will understand how to split a list into two halves. A list is an ordered collection that allows us to store and access elements sequentially. It contains index-based methods to insert, update, delete, and search the elements. It can also have duplicate elements. We will be using different approaches to split a list into two halves − Problem Statement Write a Java program to split a list into two halves. As demonstrated below − Input Input list :[Java, Python, JavaScript, Shell, Scala] Output The first half of the list is: [Java, Python] The second half of ... Read More

674 Views
In this article, we will understand how to splitting into a number of sub-strings. String is a datatype that contains one or more characters and is enclosed in double quotes(“ ”). A part or a subset of string is called substring.Below is a demonstration of the same −Suppose our input is −Input string: JVMThe desired output would be −The substring list printed as an ArrayList : [J, JV, JVM, V, VM, M] The sub-strings after splitting is: (1) "J" (2) "JV" (3) "JVM" (4) "V" (5) "VM" (6) "M"AlgorithmStep 1 - START Step 2 - Declare a string namely ... Read More