使用Java编写的菜单驱动程序,用于执行基本的字符串操作

使用Java编写的菜单驱动程序,用于执行基本的字符串操作

String指的是一系列的字符。在Java中,String是对象。为了创建和操作字符串,Java提供了String类。String类有许多内置方法,用于不同的目的。

We will perform a few basic string operations by using inbuilt String methods.

replace() Method: It replaces a specified character in the given string. concat() Method: It appends another string to the end of one string. length() Method: It returns the length of the given String. Equals() Method: It checks whether two strings are equal or not. 登录后复制