Java

Let’s learn operators in java. Operators in java Operator is a symbol used to perform operations on variables. Here are types of operators, Arithmetic operators Arithmetic operator is used in mathematical expressions to perform division, addition, subtraction and multiplication. public class ArithmeticOperatorDemo { public static void main(String[] args) { int i = 25; int j…

Read More Operators in java

Let’s learn variables in java. Variables in java Variables are a way to store information in a computer. Variables defined in a java program can be accessed by a name we give them. Syntax: datatype variableName = value; To define a variable we need to specify the data type, then give our variable a name,…

Read More Variables in java

Let’s learn major features of java. Major features of java Here are some important features of java. It’s also known as java buzzwords. Java is, Simple Java is concise, easy to write, understand and learn. Java is designed based on C++ so that programmers could learn it easily. It eliminates several language features available in…

Read More Major features of java

Let’s learn java overview. Java overview History of java Java was developed by James Gosling at Sun Microsystems Inc. and released in 1995 as core component of Sun Microsystems. Initially it was named as Oak. Because there was an Oak tree outside James Gosling office. Later it was named Green, Java coffee and finally to java.…

Read More Java overview

Let’s learn switch statement in java. Switch statement in java Switch statement is used to choose one of the few blocks of code to get some output. Here in switch statement switch expression is evaluated once and compared with each “case” value. Then if there is a match with any of the “case”, corresponding code…

Read More Switch statement in java

Let’s learn java String toCharArray() method. Java String toCharArray() method Java String toCharArray() method converts given string into new character array. Syntax public char[] toCharArray() Return Returns a newly allocated character array whose length is the length of this string and whose contents are initialized to contain the character sequence represented by this string. Let’s…

Read More Java String toCharArray() method

Let’s learn java String trim() method. Java string trim() method String trim() method removes leading and trailing whitespaces from a string. This whitespace or space character unicode value is ‘\u0020’. trim() method checks space character before and after the given string. If it exists then trim() method removes whitespaces and returns the string. Syntax: public…

Read More Java String trim() method

Let’s learn reverse a string in java. Reverse a string in java Let’s learn following ways or different methods to reverse a string. As we know that String is immutable. String class do not have reverse() method. While StringBuffer class has reverse() method. First let’s learn to reverse a string using ByteArray. class ReverseStringByteArray {…

Read More Reverse a string in java