Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


gaayatri
java progaram
1 Answer(s)      5 years ago
Posted in : Java Beginners



Advertisement
View Answers

October 8, 2009 at 11:58 AM


Hi Friend,

Try the following code:

import java.util.*;

class StringProgram{
public static void main(String []args){
System.out.println("Enter any string");
Scanner input=new Scanner(System.in);
String st=input.nextLine();
int len=st.length();
char ch[]=st.toCharArray();
String str="";
System.out.println("******Reversed String******");
for(int i=len-1;i>=0;i--){
System.out.print(ch[i]);
}
System.out.println();
System.out.println("******Sorted String******");
Arrays.sort(ch);
String s=new String(ch);
System.out.println(s);
}
}

Thanks


Related Tutorials/Questions & Answers:
java progaram - Java Beginners
java progaram  write a java program to read these strings apple orange banana and display the frist character of each string then next characterof each so on? this is urgent send the source soon  Hi Friend, Try
java progaram - Java Beginners
java progaram  write a java program to read 1 to n numbers and display the odd and even numbers of the list separately   Hi Friend, Try the following code: import java.util.*; class OddEvenList{ public static
Advertisements
java progaram - Java Beginners
java progaram  write a java program to read a string without using string function reverse the string and also give the alphabetical order of the string  Hi Friend, Try the following code: import java.util.
Solve Program - Java Beginners
Solve Program  Write a progaram in java to display all odd number from 1 to 100   hi use this code package rajanikant.code.sep_2008...://www.roseindia.net/java/ Thanks
java
java  diff bt core java and java
java
java  what is java
java
java  different between java & core java
java
java  explain technologies are used in java now days and structure java
java
java   why iterator in java if we for loop
Java
Java   Whether Java is pure object oriented Language
JAVA
JAVA  how the name came for java language as "JAVA
java
java  what is java reflection
java
java  is java open source
java
what is the size of array in java ?  what is the size of array in java ? what is the mean of finalize in java
java
java   in java does not pointers concept but what is nullpointers in java?   nullpointer is a runtime Exception
java
java  write a java program using filenotfoundexception
Java
Java  how to draw class diagrams in java
java
java   difference between class and interface
java
java  why multiple inheritance is not possible in java
java
java  explain object oriented concept in java
java
java  is java purely object oriented language
Java
Java   Whether Java is Programming Language or it is SOftware
java
java  what are JAVA applications development tools
java
java  how use java method
java
java  send me java interview questions
java
java  write a program in java to acess the email
java
java  Write a java code to print "ABABBABCABABBA
java
java  why to set classpath in java
java
java  why to set classpath in java
java
java  why to set classpath in java
java
java  why to set classpath in java
Advertisements
 

 

 

DMCA.com