system specific limit

Discussion in 'Java' started by asit, Jun 24, 2008.

  1. asit

    asit Guest

    Does java provide any specific library to know the limit of different
    data types like limits.h in C ???
     
    asit, Jun 24, 2008
    #1
    1. Advertising

  2. asit

    asit Guest

    On Jun 24, 1:41 pm, Wayne <nos...@all.4me.invalid> wrote:
    > asit wrote:
    > > Does java provide any specific library to know the limit of different
    > > data types like limits.h in C ???

    >
    > None is needed. Unlike C, the primitive datatypes in Java have
    > very specific meaning that do not change with the CPU you
    > happen to be using. See the Java Language Specification,
    > or any decent textbook.
    >
    > -Wayne


    So answer to my question is a Strict No
     
    asit, Jun 24, 2008
    #2
    1. Advertising

  3. Wayne <nospam@all.4me.invalid> wrote:
    > asit wrote:
    >> Does java provide any specific library to know the limit of different
    >> data types like limits.h in C ???


    > None is needed. Unlike C, the primitive datatypes in Java have
    > very specific meaning that do not change with the CPU you
    > happen to be using. See the Java Language Specification,
    > or any decent textbook.


    Nevertheless, the limits of each primitive type can still be
    obtained: each primitive has it's wrapper, like "Integer"
    for "int", and these wrappers have static fields for the
    maximum and minimum values of their corresponding primitives.
    (MAX_VALUE and MIN_VALUE)
    There are also some more such static fields with that kind
    of information, e.g. "SIZE" and several more for float/double.
     
    Andreas Leitgeb, Jun 24, 2008
    #3
  4. asit

    Roedy Green Guest

    On Tue, 24 Jun 2008 01:25:35 -0700 (PDT), asit <>
    wrote, quoted or indirectly quoted someone who said :

    >Does java provide any specific library to know the limit of different
    >data types like limits.h in C ???


    You don't need one. All sizes are absolutely nailed down in the JLS.
    This is one of the nicest features of Java. The same program means
    the same thing on all platforms in terms of the range of possible
    values of each variable.


    See http://mindprod.com/jgloss/sizeof.html
    http://mindprod.com/jgloss/jls.html
    --

    Roedy Green Canadian Mind Products
    The Java Glossary
    http://mindprod.com
     
    Roedy Green, Jun 24, 2008
    #4
  5. asit

    Roedy Green Guest

    On Tue, 24 Jun 2008 01:46:38 -0700 (PDT), asit <>
    wrote, quoted or indirectly quoted someone who said :

    > So answer to my question is a Strict No


    the answer is "sort of". There are no built-in constants for the
    number of bits in the various primitives (though they are defined in
    the JLS), but there are constants for the min/max values of various
    primitives. E.g. Long.MIN_VALUE.

    See http://mindprod.com/jgloss/sizeof.html
    --

    Roedy Green Canadian Mind Products
    The Java Glossary
    http://mindprod.com
     
    Roedy Green, Jun 24, 2008
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Michael Per

    limit system resources for a request

    Michael Per, Jun 1, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    431
    Michael Per
    Jun 1, 2005
  2. =?Utf-8?B?SmF2?=

    Is ViwState Page-Specific or UserControl-Specific

    =?Utf-8?B?SmF2?=, Aug 16, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    571
    =?Utf-8?B?SmF2?=
    Aug 16, 2006
  3. Replies:
    1
    Views:
    1,130
    Victor Bazarov
    Jun 28, 2005
  4. mazdotnet
    Replies:
    2
    Views:
    424
    Alexey Smirnov
    Oct 2, 2009
  5. William FERRERES
    Replies:
    7
    Views:
    237
    William FERRERES
    Jul 9, 2007
Loading...

Share This Page