aspose file tools*
The moose likes Beginning Java and the fly likes java integer data types Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "java integer data types" Watch "java integer data types" New topic
Author

java integer data types

RajivAwadhesh kumar
Greenhorn

Joined: May 20, 2011
Posts: 24
Why java does not have unsigned integer types?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18114
    
    8

Because the designers of the language decided not to include them.
RajivAwadhesh kumar
Greenhorn

Joined: May 20, 2011
Posts: 24
what is the idea behind not including unsigned integer types in java?
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 13868
    
  10

Right from the horse's mouth, Java inventor James Gosling:
James Gosling wrote:
For me as a language designer, which I don't really count myself as these days, what "simple" really ended up meaning was could I expect J. Random Developer to hold the spec in his head. That definition says that, for instance, Java isn't -- and in fact a lot of these languages end up with a lot of corner cases, things that nobody really understands. Quiz any C developer about unsigned, and pretty soon you discover that almost no C developers actually understand what goes on with unsigned, what unsigned arithmetic is. Things like that made C complex. The language part of Java is, I think, pretty simple. The libraries you have to look up.

So, it is because James thought unsigned integer arithmetic was too confusing for the average developer.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 10908
    
  12

I would also turn the question around...

Why do you think they SHOULD have included unsigned ints? What purpose would they gain you that you can't get by using un-signed.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java integer data types
 
Similar Threads
clarify my doubt
need answers
so confused, help
question related to float
Is this valid: All the Java integral types are signed numbers