Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2010
    Posts
    2
    Rep Power
    0

    Lightbulb Whats Wrong I m nt Getting output -please please help

    public class Literals
    {
    public static void main(String[] as)
    {
    char a = 0x123;
    char b=123;
    char c=(char)70000;
    System.out.println("a = " + a + " b = " + b + "c =" + c );
    }
    }

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

  3. #3
    Join Date
    Oct 2010
    Posts
    2
    Rep Power
    0

    Default

    I am getting output as a = ? b = {c =?

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    The console is limited in the characters it will display. You may have better luck showing the characters in a GUI. For e.g.,
    Java Code:
    import javax.swing.JLabel;
    import javax.swing.JOptionPane;
    
    public class Literals {
       public static void main(String[] as) {
          char a = 0x123;
          char b = 123;
          char c = (char) 70000;
          
          String result = "a = " + a + " b = " + b + "c =" + c;
          System.out.println(result);
          
          JOptionPane.showMessageDialog(null, new JLabel(result));
       }
    }

Similar Threads

  1. whats wrong
    By atenv in forum New To Java
    Replies: 6
    Last Post: 06-15-2010, 02:55 PM
  2. whats is wrong with this app??
    By mrajan in forum New To Java
    Replies: 4
    Last Post: 06-09-2010, 11:56 PM
  3. Whats wrong with my maths???
    By soc86 in forum New To Java
    Replies: 4
    Last Post: 11-03-2008, 06:52 PM
  4. Cannot understand whats wrong
    By Lehane_9 in forum New To Java
    Replies: 1
    Last Post: 03-06-2008, 08:57 PM
  5. Whats wrong with my code???
    By Soda in forum New To Java
    Replies: 2
    Last Post: 12-06-2007, 01:54 PM

Tags for this Thread

Posting Permissions

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