English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

import java.util.*;

class test{
public static void main (String args[]) {
Scanner scanner = new Scanner(System.in);

String lineSeparator
= System.getProperty("line.separator");

scanner.useDelimiter(lineSeparator);
String quote;
System.out.print("Enter my quote:");

quote = scanner.next();

System.out.println("Your have entered:" + quote);


}}

how to get it to read and print every time i input something?

2006-10-15 03:50:51 · 2 answers · asked by jytopy 4 in Computers & Internet Programming & Design

i'm not getting compile errors...
but it keep looping even though i didn't put any loop.

2006-10-15 16:33:07 · update #1

2 answers

so you want to read and print it every time you input.To accomplish this you need to write a loop or you need to create a thread that listens for input.

2006-10-19 21:58:10 · answer #1 · answered by Anand 3 · 2 1

The scanner class was new to me, but I looked it up and I can't find too much wrong with the code you have. You may need to just strip the program down and get one part working, then expand it. For example, right now, you don't have any sort of looping mechanism, so it should just print once.

http://java.sun.com/j2se/1.5.0/docs/api/java/util/Scanner.html might be able to help.

Are you getting any compiler errors?

2006-10-15 11:08:07 · answer #2 · answered by certron_80 2 · 0 1

fedest.com, questions and answers