Text Size
Thursday, October 01, 2020

Content

Content

Parent Category: ICS3U
Comment (0) Hits: 3144

Triangle Game

The triangle game is a pencil and paper game. 

The game board is as follows:

      O
    O O
   O O O
  O O O O
 O O O O O
O O O O O O

Parent Category: ICS3U
Read More Comment (0) Hits: 3938

If Else-if & Else

Conditional statements allow the program to go in different directions. They are like the choose-your-own adventure books you might have read as a child.

if (condition1)
statement1;

else if (condition2)
statement2;

else
statement3;

In the above if structure if condition1 is true then statement1 is executed. If condition2 is true then statement2 is executed. Otherwise if neither condition1 nor condition2 is true statement3 is executed.

For example:
if (x == 3)
x=6;

else if (x < 7)
x=5;

else
x=3;

Logically the above code reads as follows:
If x is equal to three x is assigned the value 6.
If x is not three but is any other number that is less then 7 then x is assigned the value 5.
Otherwise if x is neither equal to 3 or less than 7 then x is assigned the value 3.

Parent Category: ICS3U
Comment (0) Hits: 3024

Java Primitive Data Types

Type Bits Values Standard
boolean Machine
Dependent
true or false
char 16 0 to 65535 ISO Unicode character set
byte 8 -128 to +127
short 16 -32 768 to +32 767
int 32 -231 to +231-1
long 64 -263 to +263-1
float 32 IEEE 754 floating point
double 64 IEEE 754 floating point

Important Non-primative Types

Parent Category: ICS3U
Read More Comment (0) Hits: 6127

Simple Loops in Java

There are three basic types of loops in Java: the for loop, the while loop, and the do loop.  Each type is explained below.

Parent Category: ICS3U
Read More Comment (0) Hits: 6136