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 ?    0 Yes 0 No

Post New Answer

More Java Related AllOther Interview Questions

Input :14000 Output : hundred and fourteen thousand.(wrong) Desired output : fourteen hundred thousand.

2 Answers   Sapient,


What is class forname java?

0 Answers  


Can the main method be overloaded?

0 Answers  


In system.out.println(), what is system, out and println?

0 Answers  


What is Map,List,hashtable,ArrayList and difference between them??

0 Answers   Cap Gemini, TCS,






What is gui in java with examples?

0 Answers  


What is the use of entity class in java?

0 Answers  


What is javabeans api?

0 Answers  


please suggest me final year project ideas for computer engg.on java as soon as possible becaus eo want to sumbit project name. and i am very confused.

1 Answers  


Why is lambda expression used?

0 Answers  


How can I check single byte, double byte of character in JTextField?(eg. japan unicode and English unicode)

0 Answers  


What is an entity in java?

0 Answers  


Categories