Hostname: Difference between revisions
Content added Content deleted
Drkameleon (talk | contribs) (added Arturo) |
|||
Line 377: | Line 377: | ||
=={{header|Java}}== |
=={{header|Java}}== |
||
<syntaxhighlight lang="java"> |
<syntaxhighlight lang="java"> |
||
import java.net.InetAddress; |
|||
class DiscoverHostName { |
|||
import java.net.UnknownHostException; |
|||
public static void main(final String[] args) { |
|||
⚫ | |||
try { |
|||
<syntaxhighlight lang="java"> |
|||
⚫ | |||
void printHostname() throws UnknownHostException { |
|||
InetAddress localhost = InetAddress.getLocalHost(); |
|||
} |
|||
⚫ | |||
} |
|||
⚫ | |||
</syntaxhighlight> |
|||
<pre> |
|||
penguin |
|||
</pre> |
|||
=={{header|JavaScript}}== |
=={{header|JavaScript}}== |