How to Get Java to Print Consecutive Asterisks

The Java "system.out" function lets you print any characters to the user's window. You can use this function to print out a long string of asterisks with your Java output. You use the asterisks to separate values or bring attention to a specific part of your output.

Instructions

    • 1

      Right-click the Java file you want to use to print the asterisks to the user's console. Click "Open With," and select your Java editor.

    • 2

      Create your Java string that contains the asterisks:

      string asterisks = "********";

      You can add as many asterisks to the string as you need.

    • 3

      Display the string on the user's console. The following code prints the string to the monitor:

      System.out.print(asterisks);

Related Searches:

References

Comments

Related Ads

Featured