[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Here Document in Java

Posted on 2009-07-05
2
Medium Priority
?
1,445 Views
Last Modified: 2012-05-07
Experts,

Regarding the "here document,"  I was wondering if there was an equivalent way to do this in a high-level language like Java? I haven't been successful finding anything as of yet. I have included an example of a Perl script here document below:

print <<EOHeader;

You will be prompted for your name and other information. Please give complete answers to each question. To return to the menu without making an entry type q [Enter].

EOHeader

This output everything between the EOHeader tags without having to use four or five print commands.

Thank you.
0
Comment
Question by:shogun5
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 16

Accepted Solution

by:
Peter Kwan earned 2000 total points
ID: 24783218
Java does not support such syntax. However, you may use StringBuffer as an alternative way like this:


StringBuffer sb = new StringBuffer();
sb.append("\n").append("You will be prompted for your name and other information. Please give complete answers to each question. To return to the menu without making an entry type q [Enter].").append("\n");
System.out.println(sb.toString());

Open in new window

0
 

Author Closing Comment

by:shogun5
ID: 31599972
Thank you!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Windows Script Host (WSH) has been part of Windows since Windows NT4. Windows Script Host provides architecture for building dynamic scripts that consist of a core object model, scripting hosts, and scripting engines. The key components of Window…
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question