Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial

Lee Marshall
1,763 Pointsstuck at Trying Code and Catching Exceptions > Challenge task 2 of 3
Android Development > Build a Blog Reader Android App > Getting Data from the Web > Trying Code and Catching Exceptions > Challenge task 2 of 3
Question: Inside onCreate(), declare a URL variable named treehouseUrl and initialize it with the URL constructor, using the URL variable as the parameter. Put this line inside a try block and then catch a MalformedURLException named e. Don't do anything in the catch block yet.
Error message: Bummer! Don't forget to initialize "treehouseUrl" with the "URL(String url)" constructor.
Why won't it let me continue?
My code:
// Add Task 2 code here
try {
URL treehouseUrl = new URL(URL);
} catch (MalformedURLException e){
}
4 Answers

Joe Brown
21,465 PointsDid you get this sorted out? I just ran it again for you and it worked fine for me. Assuming you have your code inside of the onCreate method you should be good. The code challenge engine could have just been giving you problems at that moment, that's happened to me before

David Miller
Courses Plus Student 8,268 PointsSomething is definitely broken

Erich Hoffer
3,453 PointsIt would not work for me so I had to skip it. Same code as OP used. Retyped it up and even went back to the video then moved forward to the quiz. Still same issue.

Erich Hoffer
3,453 PointsI went back and got it to work. It was a curly brace in my instance.
Lee Marshall
1,763 PointsLee Marshall
1,763 PointsAfter about 20 minutes I just decided to manually skip it, got to the next quiz and it had the output and took it in that format and went back and it worked. Something with my format it didn't like.
Thanks.