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

What about 'hostile applets'? : java security

0 Answers  


how ahstraction is the property of oops,this is also in c and c++ ex. printf function which is also hide the unnecessary data,so what is the difference ? and does c++ fallow the abstraction?

0 Answers  


Is java installed on windows 10?

0 Answers  


Describe life cycle of thread?

0 Answers  


What is predicate in lambda expression?

0 Answers  






What is servlets.

10 Answers   HCL, Infosys,


Topic- looping,function overloading,nesting ,polymorphism. Aim - to write a function with a name buzz-buds,that will check whether the given numbers are buddies or not on the basis of no. of parameters passed during function calling.

0 Answers  


What is a delimiter in java?

0 Answers  


What is the difference between Enumeration and Iteration interfaces? What is the way of to retreive the objects from these interfaces ?

1 Answers   Cap Gemini,


Where is java installed?

0 Answers  


What is a bean class?

0 Answers  


Which is the best book for whole java study?

12 Answers  


Categories