Meaningless Drivel is fun!*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes From marcus green Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "From marcus green" Watch "From marcus green" New topic
Author

From marcus green

Arunan Ramanathan
Greenhorn

Joined: Jul 31, 2007
Posts: 24
Which of the following statements are true?

1) The following statement will produce a result of 1. System.out.println( -1 >>>2);
2) Performing an unsigned left shift (<<< on a negative number will always produce a negative number result
3) The following statement will produce a result of zero, System.out.println(1 >>1);
4) All the Java integral types are signed numbers


I got the above question from marcus green mock test 3.

The answer for the above question they quoted as 3.

my answer is 3 and 4.I read that all java integral types are signed numbers.But in the answer they are telling that char is unsigned.

My doubt, char is one of the integral type or not?


Scjp 1.4 - 80%
sharathchandra edupuganti
Greenhorn

Joined: Aug 21, 2007
Posts: 2
Hi,
All integral types are signed except char.look at
http://www.unix.org.ua/orelly/java/javanut/ch02_06.htm

--Sharath
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by Arunan Ramanathan:
...My doubt, char is one of the integral type or not?

Yes, char is specified as an "integral type" in the Java Language Specification. See section 4.2 Primitive Types and Values...
The integral types are byte, short, int, and long, whose values are 8-bit, 16-bit, 32-bit and 64-bit signed two's-complement integers, respectively, and char, whose values are 16-bit unsigned integers representing UTF-16 code units (�3.1).

[ September 06, 2007: Message edited by: marc weber ]

"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: From marcus green