Additional String Methods.

“Please Try to pass the comments.After reading this post.Thank You!.” 1) int compareTo(Object o):-Compare this string to the another object. 2) int compareTo(String anotherString):-It will compare the two strings lexicographically. 3) int compareToIgnoreCase(String str):-It will compare the two strings lexicographically and ignoring the differences of the cases. 4) boolean contentEquals(StringBuffer sb):It will return the true…

Read More

String Format.

“Please Try to pass the comments.After reading this post.Thank You!.” Introduction: Printf and format methods are used for the formatting of the numbers.The string class have an equivalent class method i.e, format().It will return the string object rather than the printStream object.String static format() are allowed to reuse the formatted string .It will oppose the…

Read More

Concatenation Java Strings.

“Try to pass the comments after reading this post.Thank You!.” Program3 : class StringProgram3 { public static void main(String [] args) { String s1=”Rahul”; String s2=”Kumar”; String s3=s1.concat(s2); System.out.println(s1); System.out.println(s2); System.out.println(s3); } } Output: Rahul Kumar RahulKumar “My name is”.concat(“RahulKumar”); “Rahul”+”Kumar” Program4: class StringProgram4 { public static void main(String [] args) { System.out.println(“Rahul”+”Kumar”); System.out.println(“My name…

Read More

JAVA STRING PROGRAM.

“Please try to pass the comments.After reading this post.Thank You!.” Program 1: class StringProgram1 { public static void main(String [] args) { char [] nameArray={‘R’,’a’,’h’,’u’,’l’,’K’,’u’,’m’,’a’,’r’}; String nameString=new String(nameArray); System.out.println(nameArray); } } Output: RahulKumar Important Points: The string class can be said as the immutable objects.Once it is created,it cannot be changed.String Buffer and Builder classes…

Read More

JAVA STRING CLASS METHODS.

Method Description 1). boolean isEmpty() It checks the String is Empty. 2). boolean contains(CharSequence s)  It will return the true or the false value after matching the sequence of the values.  3) boolean equals(Object another).  It will check the equality of the string with the object.  4) char charAt(int index).  It will return the char…

Read More

JAVA STRING.

“Try to pass the comments.After reading this post,these are required for maintaining and providing quality to the end users.Thank You.” Operations: In this,we will be going to learn about the operation on it.We will be going to see the 1) Compare. 2) Compare to. 3) Concat. 4) Equals. 5) Split. 6) Length. 7) Replace. 8)…

Read More