Results 1 to 2 of 2
  1. #1
    ezee is offline Member
    Join Date
    Mar 2009
    Rep Power

    Default How to prevent sum of variables inside sysout

    Java Code:
    System.out.println(a2[0] + a2[1] + a2[2]);
    This will add, how to restrict them to perform sum operation.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Blog Entries
    Rep Power

    Default Re: How to prevent sum of variables inside sysout

    Do you want to display them as a String? If so, a shorthand way to do this is to make an empty String the first part of the println parameter:

    Java Code:
    System.out.println("" + a2[0] + a2[1] + a2[2]);

Similar Threads

  1. Replies: 9
    Last Post: 04-12-2011, 07:26 PM
  2. Using variables inside methods?
    By Forty0ztoFreedom in forum New To Java
    Replies: 2
    Last Post: 04-08-2011, 07:36 PM
  3. Prevent object from going off the screen
    By plexus0208 in forum AWT / Swing
    Replies: 1
    Last Post: 11-18-2010, 02:04 PM
  4. Naming variables inside a cicle
    By jack DANIEL's in forum New To Java
    Replies: 5
    Last Post: 11-01-2010, 07:13 PM
  5. prevent my folders
    By syedabu in forum JavaServer Pages (JSP) and JSTL
    Replies: 2
    Last Post: 03-24-2010, 03:57 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts