Nothing Special   »   [go: up one dir, main page]

Java Codelab Solutions - Section 2.2.3

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Section2.2.

3FloatingPointDataTypes
20541:Declareafloatvariablenamedprice.
floatprice
20542:DeclareadoublevariablenamednetWeight.
doublenetWeight
20511:Declareavariablex,suitableforstoringvalueslike3.14159and6.02E23.
floatx
20980:Writeasinglestatementthatwillprintthemessagefirstisfollowedbythevalueoffirst,andthenaspace,followed
bysecond=,followedbythevalueofsecond.Printeverythingononelineandgotoanewlineafterprinting.Assume
thatfirsthasalreadybeendeclaredasadoubleandthatsecondhasbeendeclaredasanint.Assumealsothatthe
variableshavealreadybeengivenvalues.
System.out.println("firstis"+first+"second="+second+"\n")

You might also like