Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > system specific limit

Reply
Thread Tools

system specific limit

 
 
asit
Guest
Posts: n/a
 
      06-24-2008
Does java provide any specific library to know the limit of different
data types like limits.h in C ???

 
Reply With Quote
 
 
 
 
asit
Guest
Posts: n/a
 
      06-24-2008
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
 
Reply With Quote
 
 
 
 
Andreas Leitgeb
Guest
Posts: n/a
 
      06-24-2008
Wayne <> 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.

 
Reply With Quote
 
Roedy Green
Guest
Posts: n/a
 
      06-24-2008
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
 
Reply With Quote
 
Roedy Green
Guest
Posts: n/a
 
      06-24-2008
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
PIX- limit web browsing for a specific machine, allowing all others. barret bonden Cisco 2 01-15-2008 08:35 PM
Some shareware has a time limit and the software will not work after the time limit has expired. anthony crowder Computer Support 20 01-16-2007 10:01 AM
c program, file size limit, how to solve? 2G bytes limit. guru.slt@gmail.com C++ 1 06-27-2005 11:05 PM
redirect traffic on specific ip to specific interface mimiseh Cisco 3 06-05-2005 09:14 PM
Limit access to specific IP address (hopefully by AD group) blautens@yahoo.com Cisco 0 01-17-2005 06:48 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57