DEV Community

hema latha
hema latha

Posted on

String with no

public static void main(String[] a


rgs) {
        // TODO Auto-generated method stub
     String word = "Chennai 600042";
     for (int i = 0; i<word.length();i++ )
     {
         if(word.charAt(i)>='0')
             if(word.charAt (i)<='9')
                     System.out.print(word.charAt(i));
     }

    }
Enter fullscreen mode Exit fullscreen mode
out put 600042
Enter fullscreen mode Exit fullscreen mode

Top comments (0)