1) Find the Merge point of two linked lists.
2) Swap two bits of integer.
3) Reverse individual words of the sentence.
4) Reverse string without using temp string.
Answer Posted / imran shaik
public class ReverseSentence {
public static void main(String[] args) {
System.out.println("please enter the Sentence");
Scanner input = new Scanner(System.in);
String s1 = input.nextLine();
String s[] = s1.split(" ");
String s3 = "";
int len = s.length;
for (int i = len - 1; i >= 0; i--) {
s3 = s3.concat(s[i]);
s3 = s3.concat(" ");
}
System.out.println(s3.trim());
}
}
| Is This Answer Correct ? | 5 Yes | 2 No |
Post New Answer View All Answers
What is formatted output?
Difference between stack and queue?
Can java object be locked down for exclusive use by a given thread?
If we allocate the memory using 'new' & de-allocated using 'free' then what will happen?
What is gui programming?
What is null statement?
Explain reverse a linked list recursive java solution?
What is the abstract class?
Why are global variables used?
Is 0 an even number?
What is instanceof keyword?
What causes memory leak in java?
What is a method header?
Is string a data type in java?
Is static a singleton?