© 2014 Firstsoft Technologies (P) Limited. login
Hi 'Guest'
Home SiteMap Contact Us Disclaimer
enggedu

Home Placements Interview Questions Java Interview Questions And Answers Java Interview Questions On Variables ▼

Java Interview Questions On Variables

14. Explain About character literals ?

Ans:

Generally the character literals are declared within a single quotes.

char ch = 'c';
char c = 'm';

The char literals can also be declared as four Unicode hexadecimal digits preceded by \u in single quotes.

Example:
char ch = '\u0065';
char c = '\u5649';

15. Explain About Integral Literals ?

Ans:

Integral literals may be declared in decimal, octal, or hexadecimal. The default is decimal.
To indicate octal , prefix the literal with zero. To indicate hexadecimal prefix the literal with x ( or X).

16. Explain About Floating point declarations ?

Ans:

In Java if you don't specify suffix to floating point value, the compiler assumes 64 bit double value.

To declare a float value suffix with f or F.
float f = 10.0f;
float f = 10.0F;

To declare a double value suffix with d or D.
double d = 10.0d;

double d = 10.0D;

If you declare a float value like following compiler gives error.
float f = 10.0;

Here we are trying to give a floating point 64 double value to a float, which is not correct because floating point literals defaults to a 64 bit double.

17. Select all correct list of keywords or Java reserved words?
[a] superclass
[b] goto
[c] open
[d] integer
[e] import, package
[f] They are all java keywords

Answer
[b] goto
[e] import, package

Previous Next
1 2 3 4 5 6
SLogix Student Projects
bottom