1.

In Inet Address class, which method returns the host name of the IP Address?(a) Public String get Hostname()(b) Public String getHostAddress()(c) Public static InetAddress get Localhost()(d) Public getByName()This question was posed to me in a job interview.This interesting question is from Socket Programming in chapter Networking of Computer Network

Answer»

Correct OPTION is (a) Public STRING get Hostname()

The best explanation: In Inet Address CLASS public String getHostname() method RETURNS the host name of the IP Address. The getHostAddress() method returns the IP address of the given host name.



Discussion

No Comment Found

Related InterviewSolutions