Results 1 to 2 of 2
  1. #1
    hotsauce is offline Member
    Join Date
    Aug 2011
    Posts
    3
    Rep Power
    0

    Default How do you determine data types?

    Java Code:
    int num1 = 1;
    double num2 = 2.2;
    
    System.out.println(num1 + num2);
    Java Code:
    Output: 3.2
    I know the the data type would be double, but is there a way you can actually test it in the compiler.

  2. #2
    pbrockway2 is online now Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,574
    Rep Power
    12

    Default Re: How do you determine data types?

    the data type would be double, but is there a way you can actually test it in the compiler.
    You could call a method which requires a double argument and the compiler will let you know quite quickly if the expression has the value of an int.

Similar Threads

  1. Java Data Types ?!
    By HearT.Hunt3r in forum New To Java
    Replies: 4
    Last Post: 08-09-2011, 05:43 PM
  2. Types of Data Persistence
    By jdipierro in forum New To Java
    Replies: 5
    Last Post: 09-28-2010, 04:30 PM
  3. primitive Data types
    By Manfizy in forum New To Java
    Replies: 2
    Last Post: 07-07-2009, 09:29 PM
  4. Array of different data types?
    By venkatteshb in forum New To Java
    Replies: 1
    Last Post: 08-27-2008, 06:42 PM
  5. Converting data types
    By bluekswing in forum New To Java
    Replies: 4
    Last Post: 01-12-2008, 01:48 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
  •