Q:

How to do that in.readLine() starts always with first line

I am trying to learn a little bit Java and wanted to create a number with queue machine, but I want to file.readLine() starts always with first line when I use this command in while.
while (true) {
    int line = 0;
    if (in.readLine() != null) {
        line++;
    }
    else {
        break;
    }
}

A:

What does your in in in.readLine() refer to?
First  you should create a BufferedReader after you import java.io.*
import java.io.*;   
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int line = 0;

while (true) {
        if (br.readLine() != null){
            line++;
        }
        else{
            break;
        }

This will start by reading the first line if that's what you mean by "starts always with first line when i use this command in 'while'" but if you mean you always want to start by the first line when the while is true then that means it will create an infinite loop.
Also note that you should put the int line=0 outside the while loop or else every time your code enters that loop it will reset the int line to 0.

