Wie gesagt - habe ein Problem mit dem return-wert.
Hier mal etwas vereinfacht ein Teil meines Quelltextes:
System.out.println(str) gibt dabei immer "null" und nicht den Return-Wert aus.
class Url
{
Hier mal etwas vereinfacht ein Teil meines Quelltextes:
System.out.println(str) gibt dabei immer "null" und nicht den Return-Wert aus.
class Url
{
public static void main( String[] args )
{
public static String stream(String str)
{
}
}{
String str = null;
stream(str);
System.out.println(str);
}stream(str);
System.out.println(str);
public static String stream(String str)
{
InputStream is = null;
try
{
catch ( Exception e )
{
finally
{
catch ( IOException e ) { }
}
return str;try
{
URL url = new URL( "url" );
is = url. openStream();
str = ( new Scanner(is). useDelimiter("//html//"). next() );
}is = url. openStream();
str = ( new Scanner(is). useDelimiter("//html//"). next() );
catch ( Exception e )
{
e. printStackTrace();
}finally
{
if ( is != null )
try { is. close();
} try { is. close();
catch ( IOException e ) { }
}
}
Zuletzt bearbeitet: