Results 1 to 20 of 21
- 10-21-2009, 11:56 AM #1
Member
- Join Date
- Oct 2009
- Posts
- 3
- Rep Power
- 0
- 10-21-2009, 12:23 PM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,373
- Blog Entries
- 7
- Rep Power
- 17
050 is the octal representation of the number 5*8+0*1 == 40. That explains the result.
kind regards,
Jos
- 10-21-2009, 12:26 PM #3
Member
- Join Date
- Oct 2009
- Location
- Belgium
- Posts
- 4
- Rep Power
- 0
you beat me to it!
- 10-21-2009, 12:30 PM #4
Member
- Join Date
- Oct 2009
- Posts
- 3
- Rep Power
- 0
Oh thanks,
This explains a lot :)
Strange that Java uses a leading 0 instead of an o to express octals. This leads in my opnion to the wrong result because leading 0's in decimal numbers should just be discarded.
- 10-21-2009, 12:57 PM #5
Member
- Join Date
- Oct 2009
- Location
- Belgium
- Posts
- 4
- Rep Power
- 0
-
There's nothing strange about it. Every language needs a way of easily defining octal integers, and this is how it is done with Java. Note that this is for integer constants, something you the programmer have complete control over, so if you understand Java, and code carefully, you should be fine. Also note that where user input is concerned and you parse the integer via Integer.parseInt, a leading 0 will in fact be discarded. Again, you the programmer has complete control over this, and in fact you can parse the number as an octal by simply changing the parser's radix.
Corrections to the above most welcome.
Also, I want to wish a hearty welcome to Jos, a well-known and highly regarded contributer in the Sun Java forums.
- 10-21-2009, 01:06 PM #7
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,373
- Blog Entries
- 7
- Rep Power
- 17
It's a C thingy which Java adopted; the reason was that no integral number has leading zeros so a zero introduces an octal number; the 0x or 0X notation is an extension to that lexical rule. They didn't use the 0b or 0B notation for binary numbers ... go and complain at Gosling, Kernighan and Ritchie for that ;-)
kind regards,
Jos
- 10-21-2009, 01:09 PM #8
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,373
- Blog Entries
- 7
- Rep Power
- 17
- 10-21-2009, 01:15 PM #9
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
I saw that joined date, compared it with the number of posts made and failed to make sense out of anything as well.
- 10-21-2009, 01:23 PM #10
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,373
- Blog Entries
- 7
- Rep Power
- 17
- 10-21-2009, 01:29 PM #11
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
Don't make fun of my name.
I'm respected here, see.
- 10-21-2009, 01:29 PM #12
Member
- Join Date
- Oct 2009
- Posts
- 3
- Rep Power
- 0
- 10-21-2009, 01:31 PM #13
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
Well for hexadecimal the x must be there so it is different.
- 10-21-2009, 02:08 PM #14
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,373
- Blog Entries
- 7
- Rep Power
- 17
- 10-21-2009, 02:13 PM #15
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
I merely stated some of my special gifts.
When I asked someone to hit their head on a desk I didn't mean to hit it there hard enough so it would crack or anything.
r035198x(<---- Good boy.
- 10-21-2009, 03:15 PM #16
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,373
- Blog Entries
- 7
- Rep Power
- 17
Tsk, tsk, making fun of innocent stupid newbies; they should be treated with respect and we should do their homework so they can party during the weekends and get a good grade without studying or working for it. Shame on you ;-)
kind regards,
Jos
ps. I removed your links in my reply because this newbie is not allowed to post any links yet ;-)
- 10-21-2009, 03:24 PM #17
Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
The Ubiquitous Newbie Tips
- 10-21-2009, 03:48 PM #18
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,373
- Blog Entries
- 7
- Rep Power
- 17
- 10-21-2009, 03:49 PM #19
A few, pbrockway, Darryl, masijade, camickr.
No conspiracy I know of.Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
The Ubiquitous Newbie Tips
- 10-21-2009, 03:51 PM #20
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
Similar Threads
-
column result query
By vikashkumar in forum JDBCReplies: 0Last Post: 04-03-2009, 02:23 PM -
problem in get result than SQL to jtable
By MS_Dark in forum New To JavaReplies: 0Last Post: 12-13-2008, 12:52 PM -
problem with displaying result..
By SCS17 in forum New To JavaReplies: 4Last Post: 04-23-2008, 11:19 AM -
Iterating through result set in JSTL
By Java Tip in forum Java TipReplies: 0Last Post: 01-15-2008, 03:13 PM -
getting a random result
By gradon in forum New To JavaReplies: 2Last Post: 07-19-2007, 03:54 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks