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