2 updated response by adding code snippet
source | link

If the items used are from the table {$wpdb->prefix}posts, then you can query for posts with

post_parent = $item->ID and post_status = 'publish'

If the query returns any post then it has children and you can add the required class.

If its for pages the code in following page can be used.

http://www.jeangalea.com/wordpress/check-wordpress-page-childrensubpages/

However there doesn't seems to be a direct way to find if child exists.

UPDATE: Added code as per your request.

global $wpdb;
$query = $wpdb->prepare("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status ='publish' AND post_type='nav_menu_item' AND post_parent=%d", $item->ID);
$child_count = $wpdb->get_var($query);
if($child_count > 0) { /* THE MENU ELEMENT HAS CHILDREN */
   .....
} else {
   .....
}

If the items used are from the table {$wpdb->prefix}posts, then you can query for posts with

post_parent = $item->ID and post_status = 'publish'

If the query returns any post then it has children and you can add the required class.

If its for pages the code in following page can be used.

http://www.jeangalea.com/wordpress/check-wordpress-page-childrensubpages/

However there doesn't seems to be a direct way to find if child exists.

If the items used are from the table {$wpdb->prefix}posts, then you can query for posts with

post_parent = $item->ID and post_status = 'publish'

If the query returns any post then it has children and you can add the required class.

If its for pages the code in following page can be used.

http://www.jeangalea.com/wordpress/check-wordpress-page-childrensubpages/

However there doesn't seems to be a direct way to find if child exists.

UPDATE: Added code as per your request.

global $wpdb;
$query = $wpdb->prepare("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status ='publish' AND post_type='nav_menu_item' AND post_parent=%d", $item->ID);
$child_count = $wpdb->get_var($query);
if($child_count > 0) { /* THE MENU ELEMENT HAS CHILDREN */
   .....
} else {
   .....
}
1
source | link

If the items used are from the table {$wpdb->prefix}posts, then you can query for posts with

post_parent = $item->ID and post_status = 'publish'

If the query returns any post then it has children and you can add the required class.

If its for pages the code in following page can be used.

http://www.jeangalea.com/wordpress/check-wordpress-page-childrensubpages/

However there doesn't seems to be a direct way to find if child exists.