tut01_2009_sol - EE3206/EE5805 Java Programming and...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
EE3206/EE5805 Java Programming and Applications Tutorial 1 – Setting Up Java Programming Environments Q3. The JAR file contains the compiled .class file(s) and a manifest file. The manifest file is plain-text file and provides some brief information of the program, such as the main class name and class path. The information is looked up by the program launcher (java.exe) when the program starts. Q4. See source code. Q5. a) It compiles, and x becomes 1 (byte). b) It compiles, and x becomes 127 (byte). c) Compilation error: “possible loss of precision; found : int; required : byte”. The byte primitive type stores values from -128 to 127. The value 128 cannot be stored in a byte variable. d) Compilation error: “possible loss of precision; found : int; required : char”. Though x is of type char, the expression (x + 1) evaluates to type int, and Java does not allow assignment an int value to a char variable without explicit casting. e) It compiles, and x becomes '1' (char). Initialization is sometimes different from assignment. Here the compiler computes '0' + 1 at compilation time to get '1', and initializes variable x to '1'. f)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/20/2010 for the course ELECTRONIC EE3206 taught by Professor Tingchiwang during the Spring '10 term at École Normale Supérieure.

Page1 / 4

tut01_2009_sol - EE3206/EE5805 Java Programming and...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online