kayden
kayden

Reputation: 13

Does the java has a buffer?

            *System.out.print("곱하고자 하는 두수 입력>>");
            a = sc.nextInt();
            b = sc.nextInt();
            System.out.printf("" + a + "*" + b + "=" + "%d", a * b);
            break;
        } catch (InputMismatchException e) {
            System.out.println("실수는 입력하면 안됩니다.");
            String c= sc.nextLine();*   

if it has a buffer, can I use it like C?
Does java have a instruction like fflush()?

Upvotes: 1

Views: 39

Answers (1)

Peter Lawrey
Peter Lawrey

Reputation: 533492

Java has System.out.flush() however it auto flushes on print etc so you don't need to call it generally.

https://docs.oracle.com/javase/8/docs/api/java/io/PrintStream.html

a PrintStream can be created so as to flush automatically; this means that the flush method is automatically invoked after a byte array is written, one of the println methods is invoked, or a newline character or byte ('\n') is written.

Upvotes: 1

Related Questions