why am i getting this java.lang.NumberFormatException? : Hi i have written the folwing code where i am declaring a string then extracting the numbers and then assigning it into a variable 'result' where i am trying to convert the numbers which is in a form of string into Integer.However i am getting an exception called java.lang.NumberFormatException how do i avoid this exception.
My code is as follows.Can anyone explain.:)..Cheers

package trialprogram;
public class Interviewaskedq {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		String S1="12SERT34";
		String alpha=" ";
		String num=" ";
		for(int i=0;i<=S1.length()-1;i++)
		{
			char ch=S1.charAt(i);
			if(Character.isAlphabetic(ch))
			{
				alpha=alpha+ch;
			}
			else if(Character.isDigit(ch))
			{
				num=num+ch;
				
			}
		}
		
		int result = Integer.parseInt(num);	
	}
}