Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2010
    Posts
    18
    Rep Power
    0

    Default Printing two values

    i need to print 2 values same time
    like
    x=2;
    y=4;
    system.out.println(x,y);
    not working
    how to write that pls help

  2. #2
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    try concatenating the number
    Java Code:
    System.out.println(x + ", " + y);
    You need the ", " or any other double quotes, or else it will print the sum of the 2 numbers, adding double quotes turns it into a string.

Similar Threads

  1. Printing memory addresses and null values
    By Ben1 in forum New To Java
    Replies: 21
    Last Post: 10-11-2010, 05:05 PM
  2. Printing values from object in Array?
    By thesinter in forum New To Java
    Replies: 3
    Last Post: 01-20-2010, 05:19 AM
  3. Problem in printing JTable values
    By shanssat in forum AWT / Swing
    Replies: 3
    Last Post: 02-04-2009, 08:15 AM
  4. Printing default Swing values
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 03-12-2008, 11:09 AM
  5. Printing ASCII values of characters
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-21-2008, 04:36 PM

Posting Permissions

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