This week's book giveaway is in the Artificial Intelligence and Machine Learning forum.
We're giving away four copies of Transfer Learning for Natural Language Processing (MEAP) and have Paul Azunre on-line!
See this thread for details.
Win a copy of Transfer Learning for Natural Language Processing (MEAP) this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
Bartenders:
  • salvin francis
  • Carey Brown
  • Frits Walraven

From marcus green

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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?
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
All integral types are signed except char.look at
http://www.unix.org.ua/orelly/java/javanut/ch02_06.htm

--Sharath
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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 ]
 
Water proof donuts! Eat them while reading this tiny ad:
Two software engineers solve most of the world's problems in one K&R sized book
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic