Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4017144
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T09:49:32+00:00 2026-05-20T09:49:32+00:00

How come when i put //private String namespace = ###Name:+name+ ###; and system.out.println(namespace) it

  • 0

How come when i put //private String namespace = “###Name:”+name+” ###”; and system.out.println(namespace) it comes out null?

I am suppose to create a tagmaker program, but I am stuck at how to line up the # on the right side.

/*################################################
###               ANNUAL CONFERENCE            ###
############################################### #
###Name:Simon                             ###
###                                           ###
############################################### #
###Organization:NBA             ###
###                                             ###
################################################*/

How do I line them up for any given name that I set it to?
I am suppose to Set the Name, Set the organization, Print tag with the name and organization, Clear the name and organization, and Print a blank tag.

—————-UPDATE 4:09AM—————————-
I am just going to model my code after this:

public class Divers {
    public static void main(String args[]){
      String format = "|%1$-10s|%2$-10s|%3$-20s|\n";
      System.out.format(format, "FirstName", "Init.", "LastName");
      System.out.format(format, "Real", "", "Gagnon");
      System.out.format(format, "John", "D", "Doe");

      String ex[] = { "John", "F.", "Kennedy" };

      System.out.format(String.format(format, (Object[])ex));
    }
   }

but can someone show me how i can do it the other way? just for learning purposes

public class AddressBookTester {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
TagMaker test =  new TagMaker("Simon", "NBA");

test.printlL();

    }

}

public class TagMaker {

private String name;
private String organization;
private String l = "################################################";
private String annual= "###               ANNUAL CONFERENCE            ###";
//private String namespace = "###Name:"+name+"                ###";
private String l2= "###                                             ###";
//private String organizationspace= "###Organization:"+organization+"###";
TagMaker (){

}

TagMaker (String tempName, String tempOrg){
name = tempName;
organization = tempOrg;

}
    void setname(String tempName){
        name = tempName;
    }

    String getname(){
        return name;
    }

    void setorganization(String tempOrg)
    {
            organization = tempOrg;
    }

    String getorganization(){
        return organization;
    }


    void printlL(){
        System.out.println(l);
        System.out.println(annual);
        System.out.println(l);
        System.out.println("###Name:"+name+"                             ###");
        System.out.println(l2);
        System.out.println(l);
        System.out.println("###Organization:"+organization+"             ###");
        System.out.println(l2);
        System.out.println(l);

    }
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T09:49:33+00:00Added an answer on May 20, 2026 at 9:49 am

    You need to set a constant for the Maximum width (in characters) of your output. Then you can do some simple arithmetic to work out how many spaces/characters etc. you need to properly format your output.

    Say if max_width = 60.

    Here’s a header:
    ############################################################ (the full 60)

    The you work out the indents and things based on the length in chars of the strings you’re outputting.

    e.g. If you want to print Name: Simon get the length of this and subtract from max_length, etc. etc.

    HTH.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given a very simple object: class User { private Integer id; private String name;
How come the following doesn't work? CREATE FUNCTION Test (@top integer) RETURNS TABLE AS
Today I decided to come up with a program that would be useful for
I come from a Java background, where packages are used, not namespaces. I'm used
I come from the Microsoft world (and I come in peace). I want to
I come across this problem when i am writing an event handler in SharePoint.
How come this doesn't work (operating on an empty select list <select id=requestTypes></select> $(function()
I come from a .NET world and I'm new to writting C++. I'm just
I come from a mainly PHP background and make good use of the Apache
I come from a CVS background. I'm currently investigating using SVN for a project.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.