Computer Science, asked by Karthikrajcore, 10 months ago

Write a java program to implement string functions

Answers

Answered by charlie1505
0

Answer:

public class Example{

public static void main(String args[]{

String s1="hello";

String s2="whatsup";

//length function

System.out.println("string length is: "+s1.length());

System.out.println("string length is: "+s2.length());

//compare function

System.out.println(s1.compareTo(s2));

//concate function

s1=s1.concat("how are you");

System.out.println(s1);

//Empty Function

System.out.println(s2.isEmpty());

}}

Similar questions