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 |
How do you sort in ascending order in java?
How to know the host from which Applet is originated?
how do you store phone numbers using java collections
What is difference between ++ I and I ++ in java?
byte a=5; byte b=5; byte c=a+b; System.out.println(c); whats the o/p?
I have multiple constructors defined in a class. Is it possible to call a constructor from another constructor’s body?
What is the difference between preparedstatement and statement in java?
how to call one program .class file in another program
What language is an assembler written in?
How does map works in java?
What is json parser in java?
What is the difference between C++ and Java and your preferences?