Space Breaking News:

Fully Managed Dedicated Servers – Fully Customizable!

Cheap Airline Deals!Take up to $50◊ off with Promo Code AIR50 Book Now!

Code

Java Program2

/* Java program by Zac J. (c) 2015 spaceedge.com
Simple Fibonacci Sequence
*/
public class Program2
{

public static void main(String[] args)
{

System.out.println(“Simple Fibonacci Sequence! \n”);

int x=0, x1=0, x2=1;

for (int i = 0; i <= 20; i++) {

System.out.println( i + “: \t x=” + x);

x1 = x; x = x1 + x2; x2 = x1;

}
}
}

To run program compile: javac Program2.java
Then run the class with:   java Program2

 

Java Program1

// Java Program1 Hello World.

public class Program1
{

public static void main(String[] args)
{

System.out.println(“Hello World! \n”);

for (int i = 0; i <= 5; i++) {

int x = 5 + i;

System.out.println(“i=” + i + “, x=5+i=” + x);

}
}
}

To run program compile: javac Program1.java
Then run the class with:  java Program1

If you get the following error:

'javac' is not recognized as an internal or external command.

From windows command prompt enter this command:

set path=C:\Program Files\Java\jdk1.8.0_65\bin;