CAt utility in java

Hello friends,

could you please advice me of how to traslate this program written in C to java?

[LEFT]#include <cstdio>
main( ){
char c;
c = getchar( );
while (c != EOF) {
putchar(c);
c = getchar( );
}[/LEFT]
}

I am supposed to test the difference in time between compiling the C program and the corresponding java program in unix. I would appreciate the help or clues to figure it out. thank you very much for your time

There's an easier way to get fixed-width chars in this forum, and it preserves spacing too, try code tags, [ code ] stuff [ /code ] without the extra spaces in the tags.

You might find this useful. Instead of opening files you could just use System.in and System.out

Just add a point here that if performance is important to you, you may find the NIO API of more interest compared with the conventional Java IO API.