Ayyan has Published 60 Articles

Java StringBuffer class.

Ayyan

Ayyan

Updated on 26-Feb-2020 09:54:34

The java.lang.StringBuffer class is a thread-safe, mutable sequence of characters. Following are the important points about StringBuffer −A string buffer is like a String but can be modified.It contains some particular sequence of characters, but the length and content of the sequence can be changed through certain method calls.They are ... Read More

Java Program to find duplicate characters in a String?

Ayyan

Ayyan

Updated on 26-Feb-2020 08:08:12

Following is a Java example which deletes duplicate elements from a given string.Exampleimport java.util.Arrays; import org.apache.commons.lang3.ArrayUtils; public class DuplicateSample {    public static void main(String args[]){       String str = "malayalam";       char[] myArray = str.toCharArray();       for(int i=0; i

How to check Palindrome String in java?

Ayyan

Ayyan

Updated on 26-Feb-2020 06:44:39

StringBuffer provides a method with name reverse() one way to check for a palindrome isCreate a StringBuffer object by passing the required string as a parameter to the constructor.Reverse the contents of the object using the reverse() method.Convert the StringBuffer object to Sting using the toString() method.Now, compare the String and the ... Read More

How to compare String equality in Java?

Ayyan

Ayyan

Updated on 26-Feb-2020 06:30:47

You can check the equality of two Strings in Java using the equals() method. This method compares this string to the specified object. The result is true if and only if the argument is not null and is a String object that represents the same sequence of characters as this ... Read More

String Concatenation by + (string concatenation) operator.

Ayyan

Ayyan

Updated on 26-Feb-2020 05:57:58

You can concatenate strings using the ‘+’ operator of Java.ExampleLive Demopublic class Test {    public static void main(String args[]){       String st1 = "Hello";       String st2 = "How";       String st3 = "You";       String res = st1+st2+st3;       System.out.println(res);    } }OutputHelloHowYou

Java String Concatenation with Other Data Types.

Ayyan

Ayyan

Updated on 26-Feb-2020 05:44:11

If you try to concatenate strings using concat() method, you can concat variables of string data type only.To concatenate strings with other data type you need to use the ‘+’ operator.Examplepublic class Test {    public static void main(String args[]){       String st1 = "Hello";       ... Read More

String Concatenation in Java

Ayyan

Ayyan

Updated on 26-Feb-2020 05:16:46

You can concatenate two strings in Java either by using the concat() method or by using the ‘+’ , the “concatenation” operator.The concat() methodThe concat() method appends one String to the end of another. This method returns a String with the value of the String passed into the method, appended ... Read More

Are there any ways to Manipulate Strings in Java.

Ayyan

Ayyan

Updated on 26-Feb-2020 05:11:31

Since String class is immutable once created we cannot modify the data of the string. But still, if you want to manipulate string data you can rely on StringBuffer or StringBuilder classes.Examplepublic class Test {    public static void main(String args[]) {       String str = "Hi welcome ... Read More

What is the Java Runtime Environment (JRE)?

Ayyan

Ayyan

Updated on 25-Feb-2020 08:19:34

JRE is Java Runtime Environment and is the machine-specific implementation of JVM. It contains libraries like rt.jar, class loaders etc which are used by JVM.

Memory management in Java

Ayyan

Ayyan

Updated on 24-Feb-2020 09:18:49

Java memory model is divided between Thread Stacks (One for each thread) and a heap area.Thread StackIt is a thread specific memory area and contains local variables, methods call information etc. JVM stacks could be of fixed size or variable size. If computation in a thread exceeds its stack size ... Read More

Advertisements