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 Java Objects (Retired) Harnessing the Power of Objects Incrementing and Decrementing

Does Java have a With..End With construct like VB?

I often use the With..End With construct in VB when I need to write several statements referring to the same object. For example:

With myObject .Open() .ReadData() .ScrubData() .ExportData() .Close() End With

Is there any equivalent option in Java?

Thanks

1 Answer

Michael Hess
Michael Hess
24,512 Points

Hi Adiv,

No, Java does not have a with end with construct.

Please see this stackoverthrow thread: http://stackoverflow.com/questions/1494800/with-statement-in-java

Hope this helps!