Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8535937
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:32:57+00:00 2026-06-11T10:32:57+00:00

Is there in Java the possibility to get what a user press when it

  • 0

Is there in Java the possibility to get what a user press “when it presses”
and not when he hits return?

So, for example, if a user hit ABC and then hit Ctrl+Z I want that the program ends there
(end of stream reached) and not, after, when he presses return.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T10:32:58+00:00Added an answer on June 11, 2026 at 10:32 am

    Windows doesn’t actually end the stream when you press Ctrl+Z; you can continue to edit the line and the application will only see the end of the stream when you press Return.

    This is slightly different to Unix where Ctrl+D will send the current buffered line to the application (without a newline) and the application will only perceive the end of the stream when you send an empty buffer by pressing Ctrl+D either after a Return or after another Ctrl+D.

    Edit: On Windows, you might be able to use the SetConsoleMode function to allow you to read single characters. I’m not sure how you would call it though; there appear to be three choices:

    1. Via JNI to a DLL that calls SetConsoleMode
    2. Invoke a program that calls SetConsoleMode
    3. Wrap your program in a launcher that calls SetConsoleMode
    4. Edit: Use JNA to call SetConsoleMode.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a possibility in Java to get rid of the necessity to catch
Is there a Java web framework that allows the user to create custom fields,
Is there any possibility that I can directly send signal to a Java virtual
Is there a possibility, that from inside your program, by calling some java library,
is there any possibility to create a server based on java that connects to
Is there a possibility, to add an image to menu item, from java code
In java there is a possibility of re-throwing the exception but there is any
There is a possibility to use C# library with Mono for Android from Java
In Java, it's possible to have methods inside an enum. Is there such possibility
Is there any standardized way (not language dependent, I need at least C++, Java

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.