TonyLa.com

Java Programs - Declaring Variables

Back To Index
 
ProblemCode
Program Variable1 declares and initializes an integer and String variable and outputs to the console each variable.
Write a program that declares an integer variable and String named age and name, respectively. Assign the integer the value 30. Assign to the String youre name. Then output to the console using the println method. Hello Mary Youre age is 30.
The Program Variable2 declares and initializes two integer variables, then swaps the two variables. That is, if the first variable holds the value 10 and the second holds the value 20, after the swap, the first will hold 20, the second 10.
 
Back To Index

Site Designed by: Tony Larrain tony@tonyLa.com
Copyright © Anthony (tony) Larrain 2004 - 2005