Get Subarray between Specified Indexes in Java

Before getting into the programming on subarray between specified indexes, let us first learn about the subarray. What is a subarray? For example, consider an array = [2,3,4], then the subarrays are [2], [3], [4], [2,3], [3,4], and [2,3,4]. But something like [2,4] would not be considered as subarray. For an array of size n, … Read more

Java Program for user String Input

It is a simple demonstration to show how to take a string as an input from the user. The only thing you need to be concerned about is the data type that you declare in the program that is the String data type as shown below in the program. String in java How to take … Read more

Java Program to Calculate Simple Interest, Amount and Compound Interest using a Switch

The program shows how to Calculate Simple Interest, Amount, and Compound Interest using a Switch in java. The program uses a scanner class to take the inputs from the user. The switch case is mostly used when it is necessary to give options to the users. The following program gives users 3 different options to … Read more