Why are we able to ping a server devapp01 here?

In this particular scenario we are able to ping the other second interface i.e devapp01 but Why is this happening since both the interfaces were in the .etc/hosts file but both were not there in there routing table . My question either both the interfaces should be pinged or none of them should give response for ping!
Also ping only resolves the name to ip address does that mean if the server is not configured through a particular gateway in the routing table , we will not be able to connect to the remote server?

Hello @gunjanbajaj246,
Maybe the interface itself is down at the remote server end, please follow the next questions to troubleshoot.

Resolving the ips by names is not related to routing, you use /etc/hosts file to resolve
but you use a routing table to reach.