String Program
String Program
P1:Write a java program to reverse the string by preserving the white spaces
package kodnest;
import java.util.Scanner;
public class Reverse {
79
KODNEST PRACTICE
OUTPUT:
80
KODNEST PRACTICE
OUTPUT:
Assignment
1.copyValueOf(): returns a string that represent the character of the character
array
2.format():Returns the formatted string using the specified local format string
and arguments
3.replaceFirst(): Replaces the first occurrence of substring that matches the
given regular expression with the given replacement
4.toString():Returns the value of string object
5.trim(): Removes whitespace from both ends of a string
6.valueOf(): Returns the string representation of the specified value.
81