JAVA:Reading from keborad stream (not using console)

drl0l1515

drl0l1515

@drl0l1515-NjYedj Sep 26, 2024
hey @ first, I just found this forum via google, got me AGAIN somhing witch i didnt wan 😡. So i hoped I may ask...

I 1st semester in IT University, I have been doing lots of programing (for fun, to make it easyer to work, etc etc.)
Most I found on Java api and google, but I cant fin any way to reat stuff directly from the keyboard.

Example: I wanted to make a program witch does NOT need the console to get a imput over it (neather *.txt files).

For instance ( in a main class):
import java.util.Scanner;

....
....

Scanner sc = new Scanner(System in);
System.out.println(sc.nextLine());
...

with that i can read stuff from the console and output it on the console.
So does anybody know how to make that work if i make/run a program and just write it in when i have a other (or none) window in front of me?


I hope I managed to explain what my propem is, and I hope u guys can help me. thx

Replies

Welcome, guest

Join CrazyEngineers to reply, ask questions, and participate in conversations.

CrazyEngineers powered by Jatra Community Platform

  • faizaan

    faizaan

    @faizaan-l83FI7 Jul 25, 2009

    hi,

    i hope you will get your answer if you read about

    character stream and byte stream from any book.