enters in java

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • c\(h\)at

    #1

    enters in java

    I want to make a message allert in Java.
    That's no problem for me.
    But the text is pretty long, and I don't know how to make enters in Java.
    So, how can I make an enter or a empty line in Java?

    grtz
    Jenny


  • Erik Renes

    #2
    Re: enters in java

    c(h)at wrote:[color=blue]
    > I want to make a message allert in Java.
    > That's no problem for me.
    > But the text is pretty long, and I don't know how to make enters in Java.
    > So, how can I make an enter or a empty line in Java?
    >
    > grtz
    > Jenny
    >
    >[/color]
    If you are using Strings to display the message the thing you are
    looking for is the newline character in java it is: '\n', you could do
    something like:
    "dear user,\nyou have just crashed the program, thank you"
    the output of this would be like:

    dear user,
    you have just crashed the program, thank you

    grtn,
    Erik

    Comment

    • anonymous

      #3
      Re: enters in java

      c(h)at wrote:[color=blue]
      > I want to make a message allert in Java.
      > That's no problem for me.
      > But the text is pretty long, and I don't know how to make enters in Java.
      > So, how can I make an enter or a empty line in Java?
      >
      > grtz
      > Jenny
      >
      >[/color]
      \n

      Comment

      • c\(h\)at

        #4
        Re: enters in java

        > > I want to make a message allert in Java.[color=blue][color=green]
        > > That's no problem for me.
        > > But the text is pretty long, and I don't know how to make enters in[/color][/color]
        Java.[color=blue][color=green]
        > > So, how can I make an enter or a empty line in Java?[/color]
        > \n[/color]

        Thank you very much!


        Comment

        • c\(h\)at

          #5
          Re: enters in java

          > > I want to make a message allert in Java.[color=blue][color=green]
          > > That's no problem for me.
          > > But the text is pretty long, and I don't know how to make enters in[/color][/color]
          Java.[color=blue][color=green]
          > > So, how can I make an enter or a empty line in Java?[/color]
          > If you are using Strings to display the message the thing you are
          > looking for is the newline character in java it is: '\n', you could do
          > something like:
          > "dear user,\nyou have just crashed the program, thank you"
          > the output of this would be like:
          > dear user,
          > you have just crashed the program, thank you[/color]

          Thank you very much!


          Comment

          • Nick

            #6
            Re: enters in java

            c(h)at wrote:[color=blue]
            > I want to make a message allert in Java.
            > That's no problem for me.
            > But the text is pretty long, and I don't know how to make enters in Java.
            > So, how can I make an enter or a empty line in Java?
            >
            > grtz
            > Jenny
            >
            >[/color]
            You need to use an escape character. if you have something like:
            String s = new String("This is a \n short string or something.");
            The output is:
            This is a
            short string or something.
            the escape character \n produces a newline.

            Comment

            • Randolf Richardson

              #7
              Re: enters in java

              ""c\(h\)at" <j.haayman.nosp am@home.nl>" wrote in comp.lang.java:
              [color=blue]
              > I want to make a message allert in Java.
              > That's no problem for me.
              > But the text is pretty long, and I don't know how to make enters in Java.
              > So, how can I make an enter or a empty line in Java?[/color]

              In addition to the other responses, you can also produce an empty line
              to the Console using the following code:

              System.out.prin tln();

              --
              Randolf Richardson, pro-active spam fighter - rr@8x.ca
              Vancouver, British Columbia, Canada

              Sending eMail to other SMTP servers is a privilege.

              Comment

              Working...