Welcome Guest | Sign in | Register
Language Fundamentals - Discussion Page For Q.3007 | Java Programming Questions and Answers | Java Programming Free Online-Tests | LucentBlackBoard | LucentBlackBoard.com

Home > Java Programming > Language Fundamentals > Questions and Answers

Q: Which of the following are valid declarations?

Note : None of the literals used here
contain the character O they are all zeroes.

1. int i = 0XCAFE;
2. boolean b = 0;
3. char c = 'A';
4. byte b = 128;
5. char c = "A";
A. 1,2 B. 1,4
C. 2,4 D. 4,5
E. 1,3

Answer and Explanation

Answer:1,3

Explanation:
1. is correct as it is a valid hexadecimal number.2. is wrong
because you can only assign the values true and false to them
4 is wrong because 128 is beyond the range of a byte. 5is wrong
because "A" is not a char it is a String. 

Comment on this Question

Name:

Loading...




Partner Sites
LucentBlackBoard.com                  SoftLucent.com                  LucentJobs.com
All rights reserved © 2012-2015 SoftLucent.