Mossah Aljalal
Mossah Aljalal

Reputation: 53

Eclipse reading StdIn(System.in) from console, but will not give any output

My problem is that Eclipse's console is taking input in the console, but it never stops taking input and will not give me any output. I created a method called histogram() that takes an integer M and an array a of integers as input. My code to read input and produce output looks like

    int M = StdIn.readInt();
    int[] a = StdIn.readAllInts();
    int[] mossah = histogram(M, a);
    for (int z = 0; z < M; z++) {
    StdOut.printf("%d", mossah[z]);
    } 

I am not allowed to use other libraries, so please do not suggest one. I was thinking that maybe there's some kind of keyboard shortcut that will make the console stop taking input but I'm not sure. I also tried using StdIn.readInts(), which gave me an error that it was depreciated, for array a's input, but it also did not work. If I assign values to array a in the code, I get my desired output, so there is nothing wrong with my method, just that code snippet I put for you guys. Any help is greatly appreciated.

Upvotes: 1

Views: 1622

Answers (1)

triadiktyo
triadiktyo

Reputation: 479

Assuming you are on windows hit Ctrl-Z to send the EOF character

Upvotes: 1

Related Questions