Loops In Java

In this article we are going to learn about loops in java. We weill learn about for loop, while loop and do while loop. We will see working of all loop and write some java program using loops in Java. Why Loops are Important ? In programming languages loops are used to repeat some lines … Read more

Float to String Conversion in Java

In this article, we are going to see how we can convert float data type to String data type in java. there are many ways available for the float to string conversion in java, which are mentioned below – Float to String conversion in java By using Float.toString() method Float.toString() is a static method of … Read more

How to convert String to Float in Java

Here we are going to see how we can convert a string value to float. String to Float Conversion String to float conversion in java is too easy. We can directly convert a String to float by using Float.parseFloat(String s) . String s = “26.7”;float f = Float.parseFloat(s); Let’s see a complete java program to … Read more

Program to Check whether Character is Alphabet or Not

In this article we are going to write java program to check whether character entered by user is alphabet or not. Java code to check if character is alphabet or not Output if character is alphabet Output if character is not alphabet

Insertion Sort

In this artcle we are going to learn about insertion sort algorithm and insertion sort implementation in java. Insertion sort:- In insertion sort the array is divided into two parts first part is sorted and second part is unsorted. To start with sorted array will have only first element in sorted array and the all … Read more

Array Sorting

In this article, we are going to discuss about array sorting and diffrent ways to sort an array and there implementation. What is Array Sorting:- Sorting means arranging items either in ascending order or descending order. Arranging an array’s elements either in ascending order or descending order is known as array sorting. We can sort … Read more

Binary Search in Java

In this article we are implementing binary search in java. Binary search is one of the most efficent searching algorithm aplicable only on sorted arrays. Here we are going to write the binary search program in java. if you want to learn about binary search algorithm you can check our post on binary search algorithm … Read more

Matrix Addition in Java

In this article, we are going to discuss how to add two matrix using java. For adding two matrix first we take input for both matrices matrix1 matrix2. Matrix addition example:- In matrix addition we have to add corresponding cells of both the matrices. An example of 3 matrix addition is given below:- Java Code … Read more

Java Code to Print Hello World

In this article we are going to write ‘Hello World’ program in java. This is a beginner level program in Java. HelloWorld.java package gangforcode;public class HelloWorld { public static void main(String[] args) { System.out.println(“Hello World!!”); }} Hello World Java Output – This is the simplest java code with the main class and a single print … Read more

Valid Parentheses Program in Java

in this article we are going to Write the program of checking valid Parentheses in java Valid Parentheses Solution validParentheses.java package gangforcode; import java.util.Stack; public class validParentheses { public static Boolean validParentheseCheck(String x) { if(x.length()<=1){ return false; } Stack<Character> stk= new Stack<>(); for(int i=0;i<x.length();i++){ if(x.charAt(i)=='[‘ || x.charAt(i)=='{‘ || x.charAt(i)=='(‘){ stk.push(x.charAt(i)); } if(stk.isEmpty()) return false; if(!stk.isEmpty()) … Read more

Multidimensional Array in Java

Multidimensional Array An array with more than one dimension is known as a multidimensional array. A multidimensional array is an array of arrays. for example, a 2D array is a collection of the 1D array. A 3D array is a collection of 2D arrays put together with a 1D array. 2D Array Declaration 2D arrays … Read more

Data Hiding in Java

Data hiding is a technique used in objected oriented programming to hide data members of the class. hiding data members means no one from outside can directly access data members or modified data members. For accessing data external person needs to go through authentication or validation. data hiding increases the data security. for example, Instagram … Read more

find one extra character in string

In this article, we are going to find one extra character in given two strings. Problem:- we have two strings s1 and s2 of length n and n+1. we need to find that one extra character in string s2 that is not present in string s1. Java code to find one extra character in given … Read more

String in Java

In this article, we are going to learn about strings in java. A string is a sequence of characters, in java string is an object which represents a sequence of characters. An array of character works the same as a string. strings are immutable in java. In java every character is stored in 16-bits. char[] … Read more

Data Types in Java

In this article we are going to discuss about data types in java. data type is set of possible values and set of allowed operation on it. it specify different sizes and vales that can be stored in a variable. There are two type of data types in java:- Primitive data types in java:- In … Read more

identifiers in java

In this article, we are going to discuss about identifiers. Identifiers are the names given to variables, methods/functions, classes, interfaces. For example:- int number=1231; String str=”identifiers in java”; In the above example “number” and “str” are the identifiers. Rules for identifiers in java:- There are some rules for declaring identifiers in java. if identifiers are … Read more

keywords in java

In this article, we are going to discuss about keywords in java. Keywords are predefine words in programing language. we cannot use these keywords as variable names because they are already predefined. Java keywords:- These are some java keywords written below. You cannot use these keywords as a identifiers in your programs. goto keyword is … Read more

binary to decimal

In this article, we are going to see how we can convert binary to decimal. We also write java code to convert binary to decimal. Binary to Decimal conversion:- Steps:- Java code to convert binary to decimal:- Output:- The same logic can be used to convert binary to decimal in other programing languages like C, … Read more

decimal to binary

In this article we are going to see how we can convert decimal to binary. We also write java code to convert decimal to binary. Decimal to Binary conversion:- For conversion of Decimal to Binary continuously divide the decimal number by 2 until decimal number become 0. and add every reminder after division at the … Read more