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


Please Help Members By Posting Answers For Below Questions

I am a fresher and know core java, c languge, html, css etc if I am illegible for any job then send it on my email tatranakshay276@gmail.com

1069


Can we cast any other type to boolean type with type casting?

533


What are some alternatives to inheritance?

551


Differentiate between the constructors and methods in java?

499


What is boolean flag in java?

572






What is the use of bufferedreader?

527


What do you understand by java?

559


What is another word for methodology?

516


How many bytes is a string?

556


Can inner class extend any class?

594


What is an immutable class?

610


Which is better singleton or static class?

501


Explain the differences between static and dynamic variables?

580


What is return code?

558


Explain the difference between abstract class and interface in java?

532