wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Inetaddress - Compilation error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Inetaddress - Compilation error" Watch "Inetaddress - Compilation error" New topic
Author

Inetaddress - Compilation error

lina ajay
Ranch Hand

Joined: Apr 04, 2008
Posts: 31
I am getting a compilation error for the following code
System.out.print(" Host Name : " + InetAddress.getHostName());

The message is "The method getHostName from type InetAddress is not static"

Any ideas how to resolve this.
Charles Lyons
Author
Ranch Hand

Joined: Mar 27, 2003
Posts: 836
Yes, if you know the difference between a static and non-static method? If not, take this topic back to the beginner's forum. As a clue, what are you actually taking the hostname of---there isn't an IP address in there at all is there?


Charles Lyons (SCJP 1.4, April 2003; SCJP 5, Dec 2006; SCWCD 1.4b, April 2004)
Author of OCEJWCD Study Companion for Oracle Exam 1Z0-899 (ISBN 0955160340 / Amazon Amazon UK )
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Inetaddress - Compilation error
 
Similar Threads
I/O AGAIN
Inheritance problem
print statement in the declaration ...
Can we modify a private variable outside a class?