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
Is java a compiler?
What environment variables are required to be set on a machine in order to run Java programs?
What are streams?
What are different types of classloaders?
What is included in core java?
What is string literal in java?
How to convert string to char and vice versa?
How do you generate random numbers in java?
What is a instance variable?
What is singleton class in ruby?
Java.util.regex consists of which classes?
What are the java ide's? Explain
Write a program to print fibonacci series
Can static method access instance variables ?
Is Java a dying language?