Write a java Program to Perform String Operation
import java.util.*;
class StringOperation
{
public static void main(String args[])
{
String first=" ",second=" ";
Scanner sc=new Scanner(System.in);
System.out.println("String_Operation");
System.out.println();
System.out.print("Enter the first string1");
first=sc.nextLine();
System.out.print("Enter the second string2");
second=sc.nextLine();
System.out.println("The string are:"+first+","+second);
System.out.println("The length of string is:"+first.length());
System.out.println("The length of string is:"+second.length());
System.out.println("The lowercase of"+first+"is:"+first.toLowerCase());
System.out.println("The concatenation first and second string:"+first.concat(""+second));
System.out.println("The first character of"+first+"is:"+first.charAt(0));
System.out.println("The uppercase of"+first+"is:"+first.toUpperCase());
System.out.println("The lowercase of"+first+"is:"+first.toLowerCase());
System.out.println("The occurance of a character in "+first+":");
String str = sc.next();
char c = str.charAt(0);
System.out.println("The "+c+" occurs at position" +first.indexOf(c)+ "in" +first);
System.out.println("The substring of "+first+" starting from index1 and ending at 4 is:" +first.substring(1,4));
System.out.println("Replacing 'a' with 'o' in" +first+" is:"+first.replace('a','o'));
boolean check=first.equals(second);
if(!check)
System.out.println(first+"and"+second+" are not same");
else
System.out.println(first+"and"+second+" are same");
}
}
Netflix mobile apps are available for Android, iOS, Windows platforms. You just have a premium membership of Netflix that’s all; you can enjoy your favorite TV shows or movies anywhere, anytime
ReplyDeletewindows activators
Check out this website for free projects www.coderush.cf
Delete