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 trialUrooba Urooba
Courses Plus Student 309 Pointsnot able to understand the error from the could below
import java.io.Console
public class Name
{
public static void main(String []args)
{
String firstName="bam";
console.printf("%s",firstName);
}
}
this is the error it is generating: JavaTester.java:76: error: Illegal static declaration in inner class Name public static void main(String []args) ^ modifier 'static' is only allowed in constant variable declarations Note: JavaTester.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. 1 error
1 Answer
jacobproffer
24,604 PointsHey Urooba,
You only need to declare a String variable called firstName and assign it a value for the first challenge. There's no need to do any sort of program set up. This is taken care of for you by default.
String firstName = "Jacob"; // Only one line of code is needed for challenge one
// You'll need to then use printf to print the required sentence for the second challenge
Urooba Urooba
Courses Plus Student 309 PointsUrooba Urooba
Courses Plus Student 309 Pointsthank you so much!