Strings in Java Programming
Previous | Home | Next |
Strings, which are widely used in Java programming, are a sequence of characters.
The Java platform provides the String class to create and manipulate strings.
class Replace()
{
public Static void main(String args[])
{
String str1 = "hello world";
System.out.println (str.Replace 'o','u');
}
}
Above is the example of method public Stringreplace(char 'char old ', 'char new')
The output of the Example is hellu wurld
Example of public StringConcat()
class public Concat
{
public Static void main(String args[])
{
String str1 = "hello";
String str2 = "world";
String str3 = str1 + " " + str2;
System.out.println(str3);
}
}
The output of above example is hello world
Previous | Home | Next |