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.

Results 1 to 4 of 4

Thread: Pls help me

  1. #1
    Junior Member
    Join Date
    Sep 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Pls help me

    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


  2. #2
    Member Darryl.Burke's Avatar
    Join Date
    Mar 2010
    Location
    Madgaon, Goa, India
    Posts
    490
    Thanks
    8
    Thanked 46 Times in 44 Posts

    Default Re: Pls help me

    Quote Originally Posted by rose_brit3 View Post
    pls write me the code for the loop.
    This is a forum, not a code factory. Write your own code and ask a specific question and you'll get help and guidance to further your learning. Show no effort and ask for code and you'll get flamed as a lazy cheater.

    db

  3. #3
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,328
    Thanks
    49
    Thanked 2,194 Times in 2,167 Posts

    Default Re: Pls help me

    Where are the characters being displayed? In a GUI in pixels or on the console by character?

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,328
    Thanks
    49
    Thanked 2,194 Times in 2,167 Posts

    Default Re: Pls help me

    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.