-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathGeometry.java
21 lines (21 loc) · 893 Bytes
/
Geometry.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//********************************************************************
// Geometry.java Author: Lewis/Loftus
//
// Demonstrates the use of an assignment statement to change the
// value stored in a variable.
//********************************************************************
public class Geometry
{
//-----------------------------------------------------------------
// Prints the number of sides of several geometric shapes.
//-----------------------------------------------------------------
public static void main(String[] args)
{
int sides = 7; // declaration with initialization
System.out.println("A heptagon has " + sides + " sides.");
sides = 10; // assignment statement
System.out.println("A decagon has " + sides + " sides.");
sides = 12;
System.out.println("A dodecagon has " + sides + " sides.");
}
}