CodeLab 09.25.06

CodeLab 09.25.06 - CodeLab: 09.25.06 Given an integer...

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

View Full Document Right Arrow Icon
CodeLab : 09.25.06 Given an integer variable count, write a statement that displays the value of count on the screen. Do not display anything else on the screen -- just the value of count. System.out.println (count); Declare a variable populationChange, suitable for holding numbers like -593142 and 8930522. int populationChange; Declare an integer variable cardsInHand and initialize it to 13. int cardsInHand = 13; Declare a reference variable of type File named myFile. File myFile; Declare a variable named myMenu suitable for holding references to Menu objects. Menu myMenu; Write a single statement that declares a reference variable of type Integer named myInt, creates an object of type Integer with the initial value of 75, and assigns it to the reference variable. Instructor's notes: For this question (as well as the questions in the Creating Objects section of Chapter 2), you should assume that the constructor takes one argument that allows us to put an appropriate value into the object we are creating. For example, the Integer class constructor takes one integer (an int) that it uses to set the initial value of the Integer object being created. Notice that "Integer" and "int" are not the same - "int" is a primitive type and "Integer" is a reference type (in other words, we can create Integer objects and send messages to them). Integer myInt = 75; Declare an integer variable named degreesCelsius.
Background image of page 1

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

View Full DocumentRight Arrow Icon
int degreesCelsius; Declare two integer variables named profitStartOfQuarter and cashFlowEndOfYear. int profitStartOfQuarter; int cashFlowEndOfYear; Write the code for invoking a method named sendSignal. There are no arguments for this method. Instructor's notes: In other words, call the sendSignal method with no inputs.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/29/2008 for the course CS 302 taught by Professor Willbenton during the Fall '07 term at Wisconsin.

Page1 / 4

CodeLab 09.25.06 - CodeLab: 09.25.06 Given an integer...

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

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