| |

VerySource

 Forgot password?
 Register
Search
Author: scct1971

Why isn't a program less than 10 lines very normal? Let me help you.

[Copy link]

1

Threads

14

Posts

12.00

Credits

Newbie

Rank: 1

Credits
12.00

 China

Post time: 2020-4-28 23:00:01
| Show all posts
Nothing wrong, okay,
Reply

Use magic Report

1

Threads

7

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-4-30 16:00:01
| Show all posts
No problem with JCreator
Reply

Use magic Report

0

Threads

14

Posts

13.00

Credits

Newbie

Rank: 1

Credits
13.00

 China

Post time: 2020-5-4 12:00:01
| Show all posts
No problem in eclipse
Reply

Use magic Report

1

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-5-6 18:45:01
| Show all posts
public class QTest {
  public static void main (String [] args) throws Exception {
    int count = 0;
    System.out.println ("Please input characters, if character is 'q', quit!");
    count = System.in.read ();
    while ('q'! = (char) count) {
      System.out.println ((char) count);
    }
    
  }
}
Why can't I stop, depressed!
Reply

Use magic Report

0

Threads

21

Posts

19.00

Credits

Newbie

Rank: 1

Credits
19.00

 China

Post time: 2020-5-17 12:15:01
| Show all posts
Press Enter after playing
Reply

Use magic Report

3

Threads

17

Posts

14.00

Credits

Newbie

Rank: 1

Credits
14.00

 China

Post time: 2020-5-20 06:30:01
| Show all posts
import java.io. *;

public class Test
{
public static void main (String [] args) throws Exception
{
char c;
while (true) {
if ((c = (char) System.in.read ())! = 'q') System.out.println (c);
else break;
}
}
}
Reply

Use magic Report

0

Threads

11

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-5-23 17:00:01
| Show all posts
Problems with IDE tools
If you are a beginner, JCreator is recommended
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-5-30 20:00:01
| Show all posts
while ('q'! = (char) (count = System.in.read ()))

You cannot enter a single 'q'

The input is 'q\n'
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list