In your case, you are using a static string in your URL constructor (a
bit naughty, but we'll skip that discussion), so you are unlikely to
see the exception, but that doesn't trump the fact that the exception
could be thrown.
try something like:
URL url = null;
try {
url = new URL("http://www.proprintsgear.com/");
}
catch (MalformedURLException e) {
// unlikely to happen with the given URL
System.out.println("this should not have happened!");
// this is naughty too
}
if (url == null) {
//ruhrho raggy!
}
-jason
All you need to do is handle that exception, and the compiler will
stop whining.
-jason
The point that Walden and MN were trying to convey is that you have a
fundamental programming error, not a GWT problem. Google Search can
turn up a number of useful tutorials on Java programming. If you're
having trouble finding one that suits you then perhaps searching
specifically for [Java variable scope] or [Java exception handling]
would be more fruitful. You might also consider buying a book on Java
programming if that's more your learning style.
Since you declared the url variable inside the try/catch block, that
is the only scope that it is available in.
you would need to declare the url outside of the try/catch block (URL
url = null;) then instantiate it inside the block (url = new URL(...))
-jason