"at line" vs "in line" [duplicate]

Solution 1:

I think there are three usages here.

One can talk about a line of code as one entity, for example the "code at line ten".

One can talk about a fragment of code that spans many lines, for example "the code at (or between, or from .. to ..) lines 5-10".

Finally, one can talk about a fragment of code within a line, for example "the object instantiation with a null constructor, which is found in line ten".

Solution 2:

If referring to a specific line, then "at" would indicate either a statement about the entire line, or possibly about the first element, while "in" would be about a subset of the line.