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
Can a class have an interface?
What is the history of java?
What is member in java?
What is dynamic array in java?
What is bom encoding?
What are white spaces in java?
Can you give names of Container classes?
What are variable names?
how to create multithreaded program? Explain different ways of using thread? When a thread is created and started, what is its initial state? Or extending thread class or implementing runnable interface. Which is better? : Java thread
What does the ‘static’ keyword mean? Is it possible to override private or static method in java?
What is the final keyword in java?
What is difference between array and arraylist in java?
Can we force garbage collector to run ?
What is the method in java?
What is the difference between applet and application?