Welcome guys in this one i'll be telling you about some more java functions
1 -How to find the length of the string inputted by user or the one you input
YOU need to do nothing just call the [string.length ] function as below
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[
class f{
public static void main(String arg[]){
String b=new String("this is another string");
System.out.println(b.length());//output-22 because length of string is 21
}
}
2-Lets join or we can say cancatinate two or more string
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[
import java.lang.*;
import java.io.*;
class f
{
public static void main(String arg[]){
char a[]={'j','a','v','a'};
String s1=new String(a);
String s2=new String(s1);
String s3=new String(s2+s1);
System.out.println("combined= "+s3);//result=javajava
System.out.println(s1.concat(s2));
]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
in this way u can join more than one strings
1 -How to find the length of the string inputted by user or the one you input
YOU need to do nothing just call the [string.length ] function as below
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[
class f{
public static void main(String arg[]){
String b=new String("this is another string");
System.out.println(b.length());//output-22 because length of string is 21
}
}
2-Lets join or we can say cancatinate two or more string
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[
import java.lang.*;
import java.io.*;
class f
{
public static void main(String arg[]){
char a[]={'j','a','v','a'};
String s1=new String(a);
String s2=new String(s1);
String s3=new String(s2+s1);
System.out.println("combined= "+s3);//result=javajava
System.out.println(s1.concat(s2));
]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
in this way u can join more than one strings
No comments:
Post a Comment