Anjana has Published 66 Articles

How to remove all whitespace from String in Java?

Anjana

Anjana

Updated on 26-Feb-2020 09:38:45

The replaceAll() method of the String class replaces each substring of this string that matches the given regular expression with the given replacement. You can remove white spaces from a string by replacing " " with "".ExampleLive Demoimport java.io.*; public class Test {    public static void main(String args[]) {   ... Read More

Check if a string contains a number using Java.

Anjana

Anjana

Updated on 26-Feb-2020 09:38:02

To find whether a given string contains a number, convert it to a character array and find whether each character in the array is a digit using the isDigit() method of the Character class.ExampleLive Demopublic class ContainsExample {    public static void main(String args[]){       String sample = "krishna64"; ... Read More

Java Program to check whether two Strings are an anagram or not.

Anjana

Anjana

Updated on 26-Feb-2020 07:39:22

According to wiki “An anagram is word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once.”To compare whether two strings are anagrams check if their lengths are equal? If so, convert these two strings into character arrays then, ... Read More

Write a java program to reverse each word in string?

Anjana

Anjana

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

StringBuffer class of the java.lang package provides reverse() method. This method returns a reverse sequence of the characters in the current String. Using this method you can reverse a string in Java.To reverse each word in a string you need to split the string, store it in an array of strings ... Read More

How to check if two strings are equal in Java?

Anjana

Anjana

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

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

Java Program to Concatenate String.

Anjana

Anjana

Updated on 26-Feb-2020 05:59:28

The concat() method of the String class concatenates the specified string to the end of this string.ExampleLive Demoimport java.lang.*;    public class StringDemo {       public static void main(String[] args) {       // print str1       String str1 = "self";       System.out.println(str1); ... Read More

Concatenate Multiple Strings in Java.

Anjana

Anjana

Updated on 26-Feb-2020 05:43:30

You can concatenate multiple strings using the ‘+’ operator of Java.Examplepublic 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

Different ways to concatenate Strings in Java

Anjana

Anjana

Updated on 26-Feb-2020 05:13:14

You can concatenate two strings in Java either by using the concat() method or by using the ‘+’ , the “concatenation” operator.Examplepublic class ConncatSample {    public static void main(String []args) {       String s1 = "Hello";       String s2 = "world";       String ... Read More

Java switch statement with multiple cases.

Anjana

Anjana

Updated on 25-Feb-2020 05:01:02

Following is the required program.ExampleLive Demopublic class Test {    public static void main(String args[]) {       // char grade = args[0].charAt(0); char grade = 'C'; switch(grade) {          case 'A' : System.out.println("Excellent!"); break;          case 'B' :         ... Read More

Using an Angular app as SAP Fiori application

Anjana

Anjana

Updated on 13-Feb-2020 10:51:11

As you mentioned, you are moving to SAP so it means you are moving to SAP HANA Cloud platform or backend SAP system. You can continue with just HTML Angular application that can connect to the backend via an OData service. Angular JS is JavaScript library that adds lot of features ... Read More

Advertisements