suppose we have one String s="india is my country"; now we
get the o/p "like country my is India". what is the logic?

Answers were Sorted based on User's Feedback



suppose we have one String s="india is my country"; now we get the o/p "like country..

Answer / neeraj03

String[] x1=s.split(" ");
for( int x2=x1.length-1; x2 >= 0; x2-- )
{
System.out.print( x1[x2] );
System.out.print( " ");
}

Is This Answer Correct ?    6 Yes 2 No

suppose we have one String s="india is my country"; now we get the o/p "like country..

Answer / naresh

String s="india is my country";
String[] news=s.split(" ");
StringBuffer sb="";
for(int i=0;i<s.length;i++){
sb.append(s[i]);
sb.append(" ");

}

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More Java Related AllOther Interview Questions

What is profile in java?

0 Answers  


What is gui in java with examples?

0 Answers  


Name primitive java types.

0 Answers  


What is reflection in java?

0 Answers  


Which is best framework in java?

0 Answers  






How can I protect myself? : java security

0 Answers  


What is the meaning of the words public, static and void?

0 Answers  


when Can an object reference be cast to an interface reference?

1 Answers  


What is jndi datasource in java?

0 Answers  


Is jpa a framework?

0 Answers  


What is the meaning of loosely coupled in java?

0 Answers  


How do I install java on windows?

0 Answers  


Categories