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.
Answers were Sorted based on User's Feedback
Answer / 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 |
What is the difference between math floor and math round?
What will happen if non-synchronized method calls a static synchronized method and what kind of lock it acquires?
How to avoid the runtime exception ?
What happens when you invoke a thread’s interrupt method while it is sleeping or waiting?
What is function overriding and overloading in java?
What is means by DLL file means ? What is the use of DLL file? What are the contents of DLL file?
What is size () in java?
What is array list in java?
How many types of exception can occur in a java program?
In how many ways we can the thread? in java
what is the volatile modifier for? : Java thread
Question 6 [9] 6.1 In what situations (in general) would you use a TreeMap? (3) 6.2 In what situations (in general) would you use a HashSet to store a collection of values?