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++;
break;
case 6: a = a + 6;
case 8: a = a + 8;
break;
default: a--;
}
else
a = a + 2;

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.