Results 1 to 5 of 5
  1. #1
    titan420 is offline Member
    Join Date
    Feb 2012
    Posts
    4
    Rep Power
    0

    Default Gibberish at end of input

    I'm going back and forth from work to home with a program, and my laptop at home just started screwing up input. i thought it might have been an edit i did on the program, so i made a simple program that asks for input, assigns it to a string, and prints the string. I am using Crimson Editor which was working fine last night. Whatever i enter into the input field, after i hit enter, it's shown as having a random number of random ascii characters at the end. When i print the string to which it is assigned, it correctly prints out the incorrect string.

    If i try to enter the word glass,here's what i get:

    ---------- Capture Output ----------
    > "C:\Program Files\Java\jdk1.7.0_03\bin\java.exe" a
    Enter something
    glass<
    glass<

    > Terminated with exit code 0.


    Here's entering 123:

    ---------- Capture Output ----------
    > "C:\Program Files\Java\jdk1.7.0_03\bin\java.exe" a
    Enter something
    123v{<
    123v{<

    > Terminated with exit code 0.


    But, if i repeat an entry, i always get the same string of gibberish appended at the end. Thanks for any help.

  2. #2
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,532
    Blog Entries
    7
    Rep Power
    20

    Default Re: Gibberish at end of input

    You should show us the source code; anything can be wrong ...

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    titan420 is offline Member
    Join Date
    Feb 2012
    Posts
    4
    Rep Power
    0

    Default Re: Gibberish at end of input

    Here's the code:

    import java.util.*;

    public class a
    {
    public static void main(String[]args)
    {
    Scanner input = new Scanner(System.in);
    String dateEntry = "";

    System.out.println( "Enter something" );
    dateEntry = input.nextLine();
    System.out.println( dateEntry );
    }
    }

  4. #4
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,532
    Blog Entries
    7
    Rep Power
    20

    Default Re: Gibberish at end of input

    So if you enter 123 it is echoed as:

    123v{š<‚

    If so, I don't think its your program to blame. Check if your Java installation is fine to start with (same compilation version as the runtime version etc.) Do you experience the same behaviour on other machines? I doubt it.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  5. #5
    titan420 is offline Member
    Join Date
    Feb 2012
    Posts
    4
    Rep Power
    0

    Default Re: Gibberish at end of input

    Thanks. I don't know what the problem was, but an uninstall/reinstall of both Crimson (Emerald) Editor and JDK2 fixed it.

Similar Threads

  1. Replies: 1
    Last Post: 11-14-2011, 01:03 PM
  2. Replies: 0
    Last Post: 10-14-2011, 12:33 AM
  3. JRE Renders gibberish
    By max1e6 in forum Java Applets
    Replies: 6
    Last Post: 07-29-2010, 12:33 PM
  4. Input technique for unknown lines of input
    By ducreative in forum New To Java
    Replies: 16
    Last Post: 09-23-2009, 09:26 AM
  5. how to take input and verify input in Java programs
    By bilal_ali_java in forum Advanced Java
    Replies: 0
    Last Post: 07-21-2007, 08:46 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •