InetAddress

Status
Nicht offen für weitere Antworten.
I

InetAddress

Gast
tach

dumme frage, aber kann InetAddress nicht richtig deklarieren:

tried:
Code:
import java.net.*;

InetAddress host = new InetAddress("www.google.ch");

Compiler-Meldung hat gesagt.:
cannot find symbol constructor InetAddress

was ist falsch?

L-ectron-X hat code- und quote-Tags gesetzt.
 

Sky

Top Contributor
Code:
InetAddress host = InetAddress.getByName( "www.google.ch" );
 
I

InetAddress

Gast
hab ich auch versucht:
unreported exception java.net.UnknownHostException; must be caught or declared to be thrown
 
B

Beni

Gast
Dann mach ein try-catch-Block:
Code:
try{
  InetAddress host = InetAddress.getByName( "www.google.ch" );
}
catch( UnknownHostException ex ){
  ex.printStackTrace();  // big problem
}
 

Sky

Top Contributor
InetAddress hat gesagt.:
hab ich auch versucht:
unreported exception java.net.UnknownHostException; must be caught or declared to be thrown
Jetzt muss ich mal Dumm fragen: Du willst Netzwerkprogrammierung machen, kannst aber eine einfache Compiler-Meldung nicht verstehen!? Solltest Du Dich evtl. erst mal mit den Basics beschäftigen ?
 
Status
Nicht offen für weitere Antworten.

Ähnliche Java Themen


Oben