In this tutorial, we will learn how to find the index of a specific element in an array using Java. These questions will be asked in the Java Interview and here we have provided detailed tutorials on how to find the Array index of a specific element. Steps: Java Program to Find the Index of a Specific Element in an […]

Java Program to Remove All Vowels from a String is one of the commonly asked interview questions related to Java Programming. steps: Java Program to Remove All Vowels from a String package TestAutomationCentral; public class RemoveVowels { public static void main(String[] args) { String str = “Test Automation Central”; String vowels = “aeiouAEIOU”; String output = “”; for(char c :str.toCharArray()){ […]

Suppose you are in the Java Interview and were asked to write a Java program determining the number of Uppercase letters or characters in a String. How could you answer this question or what could be your approach to solving this Java program? Well, one of the approaches we will discuss in this tutorial. Steps Java Program To Find the […]

In the Java interview, one of the most commonly asked interview questions is to write a Java program to count the number of occurrences of a specific character in a String. If you prepare well in advance, you can quickly and confidently answer or write this Java program to qualify for the upcoming interviews. Steps: Java Program: Output:

One of the commonly asked Java Interview Questions is how to remove all duplicates from an ArrayList. We will use Set to remove the duplicate values and then pass that HashSet to the ArrayList without duplicate values. Step 1: Initialized the ArrayList with duplicate values Step 2: Initialized the Set and passed duplicate values in the HashSet constructor Step 3: […]

The most commonly asked interview questions and answers for SQL Interviews. In this article, we will discuss and focus mainly on the SQL Queries Interview. SQL Query To Print Details Of The Employees Who Have Born In Specified Year select * from employeeswhere year(birth_date) = 1965 SQL Query To Print Details Of The Employees Whose FIRST_NAME Ends With ‘t’. select […]

Java Programs on String are commonly asked interview questions. In this article, we will discuss – how to reverse a String in Java without using an in-built function. Step 1: First, we will convert the String to a char[] array using String function – toCharArray() and store it in variable arr Step 2: Initialized an empty string i.e. null Step […]

In Java Exception Handling, finally block will always be executed irrespective of any exception in the try-and catch block. However, there are two scenarios in which the finally block may not be executed. #1 – System.exit(0) When System.exit(0) is used, the JVM will exit and the finally block will not be executed public static void systemExitFinally() { System.out.println(“#1 – System.exit(0)”); […]

If you have recently upgraded to the latest ChromeDriver and are encountering the “java.io.IOException: Invalid Status code=403 text=Forbidden” error, while trying to initialize ChromeDriver, then there are a couple of ways to resolve it. Firstly, you can add dependencies and set properties to overcome this error. Add the following dependency to your project: <dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-http-jdk-client</artifactId> <version>4.8.1</version> </dependency> Then, set […]

How to Handle Multiple Windows/Tabs in Selenium? Firstly, We will open three different tabs with different URLs and store unique identifier strings returned by the getWindowHandle() method in tab1, tab2, and tab3 string variables. Next, we will switch to Tab 2 using the driver.switchTo().window() method. We will then use the getWindowHandles() method to get the window handles and store them […]