View Single Post
  #3 (permalink)  
Old 10-12-2008, 07:04 AM
Eranga's Avatar
Eranga Eranga is offline
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 7,513
Rep Power: 11
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Default
Here is a the solution in the first way that Fubarable explain,

Code:
        Scanner scn = new Scanner(System.in);
        String result = null;
        
        System.out.println("Enter the value: ");
        String str = scn.nextLine();
        
        if(str.length() == 1)
            result = str + "0";
        else 
            result = str.substring(0, (str.length() - 2)) + 
                    str.charAt(str.length() - 1) + str.charAt(str.length() - 2);
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
Someone helped you? their helpful post.
Help:Forums FAQ|How To Ask Questions The Smart WayResources:The Java Tutorials|Glossary for Java|NetBeans IDE|Sun DownloadsWeb:WritOnceTips:Is your IDE the best?|Which Application Server?
Reply With Quote