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 does snprintf return?
What is the implementation of destroy method in java. Is it native or java code?
Explain the public class modifier?
what is meant by encapsulation?
What is downcasting?
Name few java util classes introduced with java 8 ?
What is functional interface in java example?
Explain thread life cycle in java?
Can one thread block the other thread?
What is constant in programming?
what is the purpose of the wait(), notify(), and notifyall() methods? : Java thread
Does java map allow duplicates?
What is garbage collection? Can it be forced to run?
Differentiate between class and structure.
Write java program to reverse string without using api?