Q1. How does bytecode differentiate java from other languages such as C or C++?

Q2. What is the dfference between the simple type Double and the class Double?

Q3. what is the difference between

(a) A single character typed in at the keyboard
(b) It's ASCII repersentation
(c) It's Unicode repersentation

Q4. what is the value of a asuming all variables are declared:

int a = 6

if ( a > 0 )
switch (a)
case 1: a = a + 3;
case 3: a++;
case 6: a = a + 6;
case 8: a = a + 8;
default: a--;
a = a + 2;

Edited by happygeek: fixed formatting

12 Years
Discussion Span
Last Post by jwenting

a) consider bytecode like an obj file for C or C++ with the JVM being the linker. Not quite what happens but close enough to start with.

b) if your book doesn't talk about that get a better book.

c) that's OS specific. What you type gets translated by the hardware into a hardware specific code which gets translated by the operating system into a potentially platform specific code which gets transferred to the JVM. The JVM works only with Unicode internally. ASCII is 8 bit, Unicode 16 bit. For those characters which exist in the ASCII set those will map to Unicode characters where the hi (or was it the low) byte have the same value as the ASCII code.

d) see b) and use your brain instead of mindlessly copying your homework.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.