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 trial

Java

Cynthia McGillis
Cynthia McGillis
585 Points

Putting string name in parenthesis

So I put my string name in parenthesis, but I didn't receive an error. I assume that is okay? Is this just a stylistic choice? Is there a best practice I should follow?

Example: My input: String place = ("Target"); Craig's input: String place = "Target";

1 Answer

Both work the same way, but generally parentheses is considered extraneous. Parentheses are only truly needed when defining a method, calling a method, or changing the order of operations.