Hello, I'm trying to solve the following problem below:
However,I'mhavingtroubleputtingthisEOFconditionintojava.HereinthestackIfoundsolutionsattempts,howevertheyarerelatedtotheuseoffiles,andformyproblemthereisnousefile.
Forexample:
while(fileReader.nextLine()!=null){Stringline=fileReader.nextLine();System.out.println(line);}
Butthisiswiththeuseoffile,whichisnotmycase.
MyproblemistorepresentthisEOFinjava.Here'sthepartofmycodethatI'mhavingtroublewith:
publicclassMain{publicstaticvoidmain(String[]args){while(?){//CondiçãodeparadaEOF...código...}
IfIremembercorrectly,inCIcoulddosomethinglike...
while(number!=EOF);
ButhowcanIdothisinjava?
IsolvedtheprobleminC,looklikethis:
intmain(){intN=0;while(scanf("%d",&N) != EOF){
... código ...
}
But I would like to solve in java, so far I am without solution, any tips?