12
Q:

string in java

public class ReverseString {
    public static void main(String[] args) {
        String s1 = "neelendra";
        for(int i=s1.length()-1;i>=0;i--)
            {
                System.out.print(s1.charAt(i));
            }
    }
}
13
String str = String.format( "Hello \n World \n my name is %s and i'm %d years old" , "Paul", 27);  
12
static String valueOf(int i) - returns the string representation of the int 
argument.
2
public char charAt(int index)
-----------------------------
String x = "airplane";
System.out.println( x.charAt(2) ); // output is 'r'
3
public boolean equalsIgnoreCase(String s)
------------------------------------------
String x = "Exit"; 
System.out.println( x.equalsIgnoreCase("EXIT")); // is "true" 
System.out.println( x.equalsIgnoreCase("tixe")); // is "false" 
1
public String trim()

String x = " hi ";
System.out.println( x + "x" ); // result is" hi x"
System.out.println(x.trim() + "x"); // result is "hix"
1
     System.out.println("abc");
     String cde = "cde";
     System.out.println("abc" + cde);
     String c = "abc".substring(2,3);
     String d = cde.substring(1, 2);
 
1
     char data[] = {'a', 'b', 'c'};
     String str = new String(data);
 
0
     String str = "abc";
 
0
public String concat(String s)

String x = "book";
System.out.println( x.concat(" author") ); // output is "book author"
0
In java, string is an object. It is sequence of character values enclosed by 
double quotes.
1
String newString = "Hello World";
0

New to Communities?

Join the community