[Tex/LaTex] \hfill doesnt work on new line

cvresumespacing

I am using res class to prepare my CV.
My code is

Secured All-India Rank 2480 in Joint Entrance Examination (JEE) among over $500,000$ applicants\hfill{\em(2010)}\\
Secured 2488th rank in All India Engineering Entrance Examination (AIEEE) among over $1,000,000$ applicants\hfill{\em(2010)}\\

and the output is as follows.
I want the First Sentence similiar to the Second Sentence where the year is at the end of the line.

The problem that i have identified is second line of the first sentence is empty except for the year and hence it is not being pushed to the right(by \hfill)
If suppose the code is

Secured All-India Rank 2480 in Joint Entrance Examination (JEE) among over $500,000$ applicants random extra characters \hfill{\em(2010)}\\
Secured 2488th rank in All India Engineering Entrance Examination (AIEEE) among over $1,000,000$ applicants\hfill{\em(2010)}\\

then the output is

Are there any specific commands which can solve this problem.(This is my first time using LaTeX/Tex)

Best Answer

This works

\rule{\textwidth}{.5pt} \strut\hfill test

as opposed to

\rule{\textwidth}{.5pt} \hfill test

What happens is that the \hfill is ignored by LaTeX when it is the first thing in a line (same as \hspace).

Related Question