Results 1 to 5 of 5
Thread: Gibberish at end of input
- 02-25-2012, 10:02 AM #1
Member
- Join Date
- Feb 2012
- Posts
- 4
- Rep Power
- 0
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.
- 02-25-2012, 12:06 PM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,412
- Blog Entries
- 7
- Rep Power
- 17
Re: Gibberish at end of input
You should show us the source code; anything can be wrong ...
kind regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 02-25-2012, 08:24 PM #3
Member
- Join Date
- Feb 2012
- Posts
- 4
- Rep Power
- 0
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 );
}
}
- 02-25-2012, 09:09 PM #4
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,412
- Blog Entries
- 7
- Rep Power
- 17
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,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 02-29-2012, 06:55 PM #5
Member
- Join Date
- Feb 2012
- Posts
- 4
- Rep Power
- 0
Similar Threads
-
Getting input from 3 input text boxes and store into 1 values
By niksipandit in forum New To JavaReplies: 1Last Post: 11-14-2011, 01:03 PM -
How do I creat a function that receive input and limits the input time
By itayjc in forum New To JavaReplies: 0Last Post: 10-14-2011, 12:33 AM -
JRE Renders gibberish
By max1e6 in forum Java AppletsReplies: 6Last Post: 07-29-2010, 12:33 PM -
Input technique for unknown lines of input
By ducreative in forum New To JavaReplies: 16Last Post: 09-23-2009, 09:26 AM -
how to take input and verify input in Java programs
By bilal_ali_java in forum Advanced JavaReplies: 0Last Post: 07-21-2007, 08:46 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks