tut01_2009_sol - EE3206/EE5805 Java Programming and...

Info icon This 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'.
Image of page 1

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

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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern