Character Input

Hello Everyone
If someone is able to assist me that would be great, my problem is that i am trying to get my code to produce the reverse string only if the letter 'B' is input but i have been fiddling around and cant get it to compile for me. Is there anyone that can assist me please. Thanks in Advance
System.out.println("Enter a selection from the menu above:");
String line = scannerObject.nextLine();
char input = 'B'
if (input = 'B');
Scanner in = new Scanner(System.in);
String prompt = "Enter a string to reverse";
       System.out.println(prompt);
       String input = in.nextLine();
       String reverse = "";
       for(int i = input.length()-1; i >= 0; i--)
        reverse += input.charAt(i);
       System.out.println("Reverse string  : " + reverse);
}

your code is a bit messed up
import java.util.Scanner;
public class FirstProgram {
     public static void main(String[] args) {
          Scanner scannerObject = new Scanner(System.in);
          System.out.println("assignment one menu.");
          System.out.println("A.PRINT A NUMBER PATTERN.");
          System.out.println("REVERSE A STRING.");
          System.out.println("EXIT THE PROGRAM.");
          System.out.println("Enter a selection from the menu above:");
          String line = scannerObject.nextLine();
          char input = 'B';
          if (input == 'B') {
               Scanner in = new Scanner(System.in);
               String prompt = "Enter a string to reverse";
               System.out.println(prompt);
               String inputStr = in.nextLine();
               String reverse = "";
               for (int i = inputStr.length() - 1; i >= 0; i--) {
                    reverse += inputStr.charAt(i);
               System.out.println("Reverse string : " + reverse);
}

Similar Messages

  • Curve 9380: Return from character input to QWERTY keyboard

    Hello,
    I own BlackBerry Curve 9380 smartphone (all touch, without physical keyboard).
    I have the following issue:
    Consider you're writing a text message, when you need a question mark you're tapping on the "&% 123"  button in the left-down corner and selecting the question mark. In order to return back to the original QWERTY keyboard you need to tap on the button again, now "ABC".
    Is that possible to automate the return to the QWERTY keyboard from character input keyboard after tapping the "space" button?
    Keyboard is returning automatically back only if you will tap on the "Enter" button.
    Adding the "space" button would be a great enhancement for touch-based devices featuring BlackBerry 7 OS.
    Thank you.
    P.S. I didn't find any better medium for my concern than this forum, if somebody knows how to reach directly to software engineering group, please let me know.

    You still have the constructor declared inside the main method! :-)
    public class TrySimpleVectorWithKeyboardInput
    public static void main(String[] args)
    public TrySimpleVectorWithKeyboardInput()
    {}Move the two lines to outside the main. It should look something like this..
    import java.util.*;
    import java.io.*;
    public class TrySimpleVectorWithKeyboardInput {
        public TrySimpleVectorWithKeyboardInput() {
          // constructor code goes here
        public static void main(String[] args)    {
            Vector names = new Vector();       
            FormattedInput kb = new FormattedInput();       
            for (int i = 0; i < 5; i++) {         
                try {           
                    System.out.print("Enter a  name ");           
                    names.add( kb.readString());         
                } catch (InvalidUserInputException e) {           
                    System.out.println("InvalidUserInputException thrown. \n" + e.getMessage());         
            System.out.println("\nThe names in the vector are:\n ");       
            Iterator j = names.iterator();       
            while (j.hasNext()) {
                System.out.println(j.next());       
    }

  • Character input disaplay after " " when show up in af:outputFormatted

    When I input text after "<" in text field and save it in database varchar2 column. It is found that all character disappear after "<" when I retrieve it with af:outputFormatted. If I retrieve it with outputText. It can show up properly.
    For example, I input <abc> in the text field. I then the retrieve character from database. All the text <abc> disappear.

    Sorry for typo in title: it should read as "character input disappear after "<" when show up in <af:outputFormatted
    If I input &lt;abc>, then, the text <abc> show up properly
    hence, what can be done to fix it if I just input <abc> instead of &lt;abc>

  • Weird character input in textfield when hitting CTRL+somekeys

    Hi,
    Whenever an input textfield has the focus, some ctrl+something key combinations (for example ctrl+s, ctrl+o) produce some weird character input, that is, these weird characters (certainly non-ascii) appear in the textfield as if you had typed them.
    This is obviously a bug, but is there any workaround? How can I prevent these combinations of keys to produce any text input at all? (without removing the focus from the textfield)?
    This only happens in Flash Player (and Adobe AIR): I've never seen those character appear in any application as a result of ctrl+S, ctrl+O or any key combination (except alt+<numerical character code>)
    Thanks in advance
    m.

    I'm not entirely sure that the issue we're facing is a font issue - I've managed to set a font for the TextField in question that can handle Japanese as well as English characters (in this case I'm using the Bitstream Cyberbit font), following guidelines in an article on the subject:
    http://www.onjava.com/pub/a/onjava/2001/04/12/internationalization.html
    If I enter the Japanese characters in a window of a native application, and then copy & paste into the TextField in my Java applet, they appear when using this font, and it seems like the applet can interpret them OK (in IE at least, still haven't tested in NS as yet) - the problem is that when entering the characters directly into the applet using the Win2k IME facility, they only appear as question marks.
    Damian.

  • Double character input error when entering data in numbers using Bluetooth keyboard.

    Using a bluetooth keyboard (Logitech) sometimes causes a double character input when entering data in numbers.
    For example if wish to enter the number "22" or the word "in" they become "2222" and "iinn". Pressing enter of tab also causes a double jump
    This problem is not always solved by turning keyboard off and on or by closing down and restarting numbers.
    This problem does not occur in any other app.
    I have used 2 different Logitech keyboards (ultra-slim and the recently new folio keyboard) and both caused the same problem.
    The error is sporadic but frequent and has lead to me often having to switch back to touch input.
    Very frustrating considering these excellent keyboards are ideal for using in numbers when working correctly!
    ANy advice would be much appreciated

    Zombie,
    Not much help I'm afraid, but I just saw your post & wanted to let you know that I have the same problem, but for me it manifests itself in many apps, and it happens with the Apple bluetooth keyboard
    . The only thing I've noticed is that it only seems to happen when I first start typing after not using the keyboard for a while (I'm not sure how long a while is, but maybe 30 seconds or so). Then I'll type & the first few letters will be fine, and then one letter double-types, and then it's fine again until I stop using it for whatever the threshold amount of time is. I'm guessing that it has something to do with the iPad's battery management & that it's shutting off the connection to the keyboard or something & once it picks it back up, then it double-types that letter.
    At least in Pages, it isn't as big of a deal because I know it's coming, I can correct it & then type for a long time. In Numbers, my keyboard use is much less consistent, so I need to be more cognisant of it.

  • Japanese character input.

    I want to save the Japanese character input from html forms into the Oracle Database
    using the euc character set. Most of the users use Windows PC, so I guess most
    of the input would be using s-jis or MS932.
    Do I need to write the character code conversion methods from s-jis and/or MS932
    to euc and vice versa or does the weblogic server do the conversion internally
    Thanks.
    Sanjay.

    Sanjay.
    You can do that by specifying EUC-JP for input-charset element of
    weblogic.xml. See the following link for more detail.
    http://e-docs.bea.com/wls/docs61///////webapp/weblogic_xml.html#1031571
    For Oracle to work with EUC charset, you need to set the environment
    variable of NLS_LANG=japanese_japan.JA16EUC. You don't need to write the
    code conversion method.
    Hope this helps,
    Reiji
    "sanjay" <[email protected]> wrote in message
    news:3c046d39$[email protected]..
    >
    I want to save the Japanese character input from html forms into theOracle Database
    using the euc character set. Most of the users use Windows PC, so I guessmost
    of the input would be using s-jis or MS932.
    Do I need to write the character code conversion methods from s-jis and/orMS932
    to euc and vice versa or does the weblogic server do the conversioninternally
    Thanks.
    Sanjay.

  • Chinese Character Input?

    Hi, I have snow leopard and I was wondering how to do the chinese character input, I know that you use the trackpad, but where do I go to do it? Thanks

    First of all you need to turn-on the features on the International Panel Located in the Preference area.
    I have encounter some bugs on the TrackPad Input. It recognize the characters quite well but, it is quite difficult to delete or accept characters you will understand what I'm saying when you tried it out.

  • Chinese Character Input (trackpad) and Spaces

    I use Spaces religiously and I can't seem to find a way to enable the Chinese Character Input (trackpad) for any space other than the first space. If I enable Chinese Character Input (controlshiftspacebar) on any space but the first one (upper left) then the Chinese Character Input dialog appears on the first space but not the space I am on. Anyone else experiencing this?
    ta

    http://discussions.apple.com/thread.jspa?messageID=10068621&#10068621

  • Japanese character input issues

    We have someone developing a chat client in flash that
    connects to an FMS server. Typing works fine in English, but if you
    try to type Japanese, it spits the characters out one at a time
    into the chat window after pressing return. This makes chat very
    difficult and extremely long for Japanese folks:
    L
    I
    K
    E
    T
    H
    I
    S
    Above is how Japanese would show up. I should mention that
    this happens only on OSX and not Windows. Anybody have any ideas on
    how to fix this? Many thanks!

    Sanjay.
    You can do that by specifying EUC-JP for input-charset element of
    weblogic.xml. See the following link for more detail.
    http://e-docs.bea.com/wls/docs61///////webapp/weblogic_xml.html#1031571
    For Oracle to work with EUC charset, you need to set the environment
    variable of NLS_LANG=japanese_japan.JA16EUC. You don't need to write the
    code conversion method.
    Hope this helps,
    Reiji
    "sanjay" <[email protected]> wrote in message
    news:3c046d39$[email protected]..
    >
    I want to save the Japanese character input from html forms into theOracle Database
    using the euc character set. Most of the users use Windows PC, so I guessmost
    of the input would be using s-jis or MS932.
    Do I need to write the character code conversion methods from s-jis and/orMS932
    to euc and vice versa or does the weblogic server do the conversioninternally
    Thanks.
    Sanjay.

  • Converting character input value to number or money

    Hello everyone. I have an element, Overtime Allowance.
    This has inputs:
    proportion
    hourly amount
    number of hours
    the formula is proportion * hourly amount * number of hours
    Now, I want to restrict the proportion input value to only two values, 1 and 1.2
    to do this, I created a value set and attached it to the input value
    I had to change the datatype of the proportion input value to Character since the number data type does not support valuesets/lookups
    the problem comes in the formula
    I enter
    overtime = to_number(proportion) * hourly amount * number of hours
    but I get an error
    using
    overtime = proportion* hourly amount * number of hours
    results in an error as well
    Does anybody know how to sort this one out?
    Many Thanks

    hi Igwe,
    I managed to create a Valueset number with 1 and 1.2 values only.
    Format Type: Number
    Maximum Size: 3
    Precision 1
    Min value: 1.0
    Max value: 1.2
    Indipendent
    Then I've entered Valueset values 1.0 and 1.2
    It worked fine with me... what kind of issue are you experiencing?
    Edited by: Giuseppe Bonavita on 19-Mar-2013 10:09 to add:
    sorry I see what you mean... the input value does not accept a valueset for validating.

  • Chinese character input, chinese character input

    I intalled Lion OS 10.7.3. however, chinese input (hand writing) cannot be used.
    i can call the application, but no chinese character cannot be input, especially when i used it on Safari.

    Cross posting
    http://forum.java.sun.com/thread.jspa?messageID=9831600

  • Special character input

    Alright, so the characters in question aren't so special - I just need vowels with acute accents ("ú", for instance), and I can't seem to place them.
    I've seen similar questions answered many times before. However, the solution provided there, and in the official help page - "hold down the key and scroll to the sides until the desired character appears" - isn't working in my phone for some reason.
    My input language is Spanish (just as it should be). The odd thing is that the letters A and E don't suffer from this issue; I can place whichever accent I need. Odder still, I get the full range of special characters in certain applications, such as in the calendar. For SMS, however, all I can use are either the unmodified letter, caps, or use a grave accent ("ù", and there's a greater difference between the two than it appears).
    I also can't seem to find the "¿" punctuation mark; it isn't in the symbol list under the "sym" key, and I don't know where else to look for it.
    Finally, there is something else I'd like to ask about: Is it possible to reconfigure the keypad so that holding down a letter will first print something other than it's capitalized form? If that was possible, it'd be much easier for me to quickly type (you guessed it) accented letters.
    Anyways, thanks for bearing with me if you made it this far. Any help with this issue would be much appreciated.

    On the U.S., U.S. Extended, and U.S. International PC keyboards, the option key turns the / character into ÷.
    In the System Preferences > Keyboard Preferences > Keyboard Tab > Modifier Keys... you can actually set the option key modifier to No Action. It does what it says and option + / is exactly what you get.

  • Single character input?

    I am trying to accept one character at time from the user, but I am having trouble doing this. I know this is easily done in in C++, but I haven't found anything that seems to do the job in Java. This is for use in an application that will be used on the comand line.
    Am I going to have to do some JNI to achieve this?

    Do you want 'getchar(); in C++?
    If you use command line argument, you can treat
    public static void main(String args[]) <- String args.
    C:> java classname argument (enter)
    command line argument will input args.
    you can access args[0], args[1] and so on.
    args[0] is String. So, you should change args[0] to char Array or use charAt method. ^^;

  • Character / Input corruption after session lock

    One of our larger customers has the following setup:
    Windows 2008 R2 Active Directory with 2x DC at a datacentre and 1x DC in their head office, 3x RDS servers in a DNS RR terminal server farm and a DC acting as a gateway server.  The end user accesses the RDS infrastructure via an external URL.
    The client PCs are Windows 7 x86 with bare minimum software.  All clients and servers are up to date with released Windows Updates.
    When a user logs into the RDS and leaves their computer, it locks after a certain amount of time.  If they unlock their computer all appears well, but when they unlock the RDS session, they invariably see character corruption which means the password
    is incorrect and they are unable to log in.
    There is a workround by users pressing ESC a few times or disconnecting and reconnecting, however a proper resolve to this issue is requested.
    Any ideas what is causing this and how I can go about troubleshooting?

    Hi,
    Thank you for posting in Windows Server Forum.
    Did you receive any specific error for your case?
    Are you passing your RD Web Server through RD Gateway?
    Does this issue occurs for all users or specific user?
    There is one Hotfix for slightly different scenario if you are passing your server through RD Gateway. Please install if it applicable and check the result.
    The Remote Desktop Gateway service incorrectly blocks a user account whose name contains localized characters in Windows Server 2008 R2
    http://support.microsoft.com/kb/2578133
    Hope it helps!
    Thanks.
    Dharmesh Solanki
    TechNet Community Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • [Solved] no non-ASCII character input in rxvt-unicode

    Hello everyone,
    For some days now, I can't write any non-ASCII characters any more in rxvt-unicode and rxvt-unicode-patched. Unfortunately, downgrading the rxvt-unicode package doesn't seem to help. To have at least a temporary solution, I'd like to know at least which packages I could try to downgrade as well. Any ideas, anyone?
    greez,
    maxmin
    Last edited by Maximalminimalist (2011-03-12 13:12:26)

    When I try to type a non-ASCII-character I get nothing at all. This happens with my custom keyboard layout (modified programmer dvorak) and in some layouts I already tried (us: altgr-intl, ch, de and fr)
    When I paste a non-ASCII characters in rxvt-unicode I get
    maxmin ~ $ ?
    This happens only on my x86_64 desktop which is more up to date than my i686 laptop. (I'm afraid now to do any updates.)
    EDIT: I'm sorry, I don't know what you mean with locale settings. What do you mean with that?
    EDIT2: Maybe just typing locale in the terminal is what you mean:
    maxmin ~ $ locale
    locale: Cannot set LC_CTYPE to default locale: No such file or directory
    locale: Cannot set LC_MESSAGES to default locale: No such file or directory
    locale: Cannot set LC_ALL to default locale: No such file or directory
    LANG=en_US.utf8
    LC_CTYPE="en_US.utf8"
    LC_NUMERIC="en_US.utf8"
    LC_TIME="en_US.utf8"
    LC_COLLATE="en_US.utf8"
    LC_MONETARY="en_US.utf8"
    LC_MESSAGES="en_US.utf8"
    LC_PAPER="en_US.utf8"
    LC_NAME="en_US.utf8"
    LC_ADDRESS="en_US.utf8"
    LC_TELEPHONE="en_US.utf8"
    LC_MEASUREMENT="en_US.utf8"
    LC_IDENTIFICATION="en_US.utf8"
    LC_ALL=
    With other terminal emulators I get sometimes also nothing and sometimes right displayed but wrong interpreted character in vim. I didn't take notes while doing that but I'll try again if needed.
    Last edited by Maximalminimalist (2011-03-06 21:51:23)

  • How to disable the special character input by Option key?

    Hi, all!
         I'm a eclipse developer and I'm get used to type (alt + /) shortcut for code tip in eclipse, but in Mac, when I type (option + /), I got ÷ symbol, how can I disable this functionality in Mac?
    Many thankS

    On the U.S., U.S. Extended, and U.S. International PC keyboards, the option key turns the / character into ÷.
    In the System Preferences > Keyboard Preferences > Keyboard Tab > Modifier Keys... you can actually set the option key modifier to No Action. It does what it says and option + / is exactly what you get.

Maybe you are looking for

  • Put my iMac g5 on desktop?

    Is there anyway I can put "my imac g5", from the finder sidebar, on my desktop?

  • Subroutine IN VTFL

    Dear Gurus, I am using a freight condition type as a header condition, The user has added freight in the price initially at the time of sales order creation, later on suppose the user wants to subtract the freight value at the time of invoice creatio

  • Cooling fan not operated correctly

    i am getting a message on start up  - " The system has detected the cooling fan function operated not correctly"

  • [SOLVED] Issue with Google's homepage on Firefox

    First off, greetings, I finally decided to give Arch a proper whirl last night. So far everything is going smoothly but I've run into an issue that I just can't seem to solve. In Firefox, google.com looks a bit odd: http://img215.imageshack.us/img215

  • Kind of a java question

    i have recently written a java program and want to distribute it. i have to make a cd and have put a design on a ec3 file but need to convert it to jpeg do you know how is there any software hopefully free that can do it. i know that this is a java f