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! While you're at it, check out some resources Treehouse students have shared here.
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 trialMary Norman
Courses Plus Student 477 PointsHow do i set a value to a declared variable in java
How do i set a value to a string already declared variable
class Intro{
String firstName = "Mary";
}
2 Answers
Simon Coates
28,694 PointsThe challenge is looking for is:
String firstName = "Mary";
(this challenge doesn't require that you write a class, or place the code in question inside a method. It's kinda artificial, but a lot of the time, it wants code in isolation and doesn't show the greater context of where the code would be placed if running in any real program. Apologies for the earlier response. I garbled some of the words.)
Mary Norman
Courses Plus Student 477 PointsLol, i guess so
Mary Norman
Courses Plus Student 477 PointsMary Norman
Courses Plus Student 477 PointsOMG!!! Thanks so much Simon for the help, i needed it and I removed the class and it worked!!!
Simon Coates
28,694 PointsSimon Coates
28,694 Pointsno worries. At least your problem was that the code you were writing was too realistic.