Welcome to Java Interview Questions. Here you will get so many questions related to java interview and java programs. It will definitely enhance your java programming knowledge.
How to Reverse a String in Java
In this blog, we will learn how to reverse a string in Java. This will be asked in the most of the interviews. This can be implemented in four different ways listed below: Convert String into Character Array and use For loop For loop with CharAt() method Using StringBuffer class Using StringBuilder class Method 1: […]
How to Perform Sum of the Digits in a Given Number in Java
In this blog, we will learn about how to sum of the digits in a given number in Java. This will be asked in the most of the interviews.This can be implemented using the below way: In the below snippet, we have done the following: Created the below variables of int type Number (assigned it […]
How to Remove Whitespaces from a String in Java
In this blog, we will learn how to remove whitespaces from a string in Java. This will be asked in the most of the interviews. This can be implemented in three different ways listed below: Convert String into character array and use for loop For loop with charAt() method Using replaceAll() method Method 1: Convert […]
How to Compare Two Arrays in Java using built-in functions
In this blog, we will learn how to compare two arrays in Java using built-in functions. This will be asked in the most of the interviews. This can be implemented in the below way: In the below snippet, we have done the following: Created two arrays and assigned some elements in it. Using built-in function […]
How to Compare Two Arrays in Java without built-in functions
In this blog, we will see how to compare two arrays in java without in-built functions. This will be asked in the most of the interview questions. In the below snippet, we have done the following: Created two arrays of same datatype and assigned those with some elements Created a helper class with parameters of […]
How to Read Data From Properties File in Java
In this blog, we will see How to Read Data From Properties File in Java. This will be asked in the most of the interview questions. Things to Remember: Mostly, the properties file is used to maintain the configurable parameters of the project. Extension for this file is “.properties” Properties file data will be in […]
How to SWAP Two Numbers in Java using Temp Variable
In this blog, we will see How to SWAP Two Numbers in Java using Temp Variable. This will be asked in the most of the interview questions. In the below snippet, we have done the following to swap two numbers using temp variable: Create two int variables and assign them with some values. Here we […]
How to SWAP Two Numbers in Java Without Temp variable or Without Third variable
In this blog, we will see How to SWAP Two Numbers in Java without Temp Variable or without third variable. This will be asked in the most of the interview questions. In the below snippet, we have done the following to swap two numbers without using temp variable: Create two int variables and assign them […]