Yes but what if the new number it encounters is larger than second largest but smaller than largest? Merely setting the second largest to the previous largest every time and not dealing with the case of a new second largest but not a new largest could result in errors sometimes.
i.e.
5 3 4 ........
Also, shouldn't you be initializing both largest and secondLargest to the lowest possible int value? (i.e. if you initialize them originally to 0 and the user only enters in negatives, then your largest, though never entered by the user, will be 0. Also, since 0 would be the original largest as well as second largest, then the secondLargest value would also be 0 as largest would never find a larger value than 0, so secondLargest would never be set to the value of the previous largest and also none of the negative values entered by the user would be larger than 0.)