Can u pls tel me hw to right justify, left justify with 80 characters in each line and also do centre alignment a given paragraph in java, pls write me the code for the loop. Thanks a lot in advance
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
Can u pls tel me hw to right justify, left justify with 80 characters in each line and also do centre alignment a given paragraph in java, pls write me the code for the loop. Thanks a lot in advance
Where are the characters being displayed? In a GUI in pixels or on the console by character?
Please post your questions here and not in a private message.
To right adjust a string, you do some simple arithmetic. Get the width of the area to print in and subtract the length of the string to be printed. That is the number of blanks/pixels you need in front of the beginning of the string.