Light.java
// Compute distance light travels using long variables.public class Light {public static void main (String [] args) {int lightspeed; long days; long seconds; long distance; // approximate speed of light in miles per second lightspeed = 186000 Days = 1000; // specify Number of days here seconds = days * 24 * 60 * 60; // convert to seconds distance = lightspeed * seconds; // compute distance system.out.print ("in" days); System.out.Print ("Days Light Will Travel About"; System.out.println (Distance "Miles.");}}
Area.java
// compute the area {public static void main (string [] args) {double pi, r, a; r = 10.8; // radius of ciecle pi = 3.1416; // pi, approximately a = Pi * r * r; // compute area system.out.println ("Area of circle IS" a);}}
.................. twodarray.java
// DemonStrate a two-dimonsel array.public class twodarray {public static void main (string [] args) {int twod [] [] = new int [4] [5]; int i, j, k = 0; for (i = 0; i <4; i ) for (j = 0; j <5; j ) {Twod [i] [j] = k; k ;} for (i = 0; i <4; i ) { For (j = 0; j <5; j ) system.ord.print (Twod [i] [j] "); system.out.println ();}}}
Twodagain.java
//Manually allocate diaicing size second dimssions.public class twodagain {public static void main (string [] args) {int twod [] [] = new int [4] []; war [0] = new int [1]; Twod [1] = new int [2]; two] = new int [3]; war [3] = new int [4]; INT I, J, K = 0; for (i = 0; i < 4; i ) for (j = 0; j
// Initialize a two-dimonse {public static void main (String [] args) {double m [] [] = {{0 * 0, 0 * 1, 0 * 2, 0 * 3}, {1 * 0, 1 * 1, 1 * 2, 1 * 3}, {2 * 0, 2 * 1, 2 * 2, 2 * 3}, {3 * 0, 3 * 1, 3 * 2, 3 * 3}}; int I, j; for (i = 0; i <4; i ) {for (j = 0; j <4; j ) system.out.print (m [i] [j] " "); System.out.println ();}}}
ThreeDmatrix.java