Pseudo Java
Pseudo Java
Output Statements
This is used for writing values to the screen.
1. Data Types printf(“%...”, expression); //expression
evaluated and its value written to the screen
using the specified format.
The following data type can be used in your
pseudocode.
Data Type Declaring a variable
int int myInt; 3. Assignment Statement
double double myDouble;
char char myChar; The assignment statement is used to manipulate
boolean boolean myBoolean; (change value) values of variables. It has the following
String String myString; syntax:
variableName = expression;
1.1. Structured Data Types expression is either a value (called literal value), a
We will only consider one and two dimensional variable or any valid Java arithmetic or
arrays. Boolean/Logical expression. The assignment MUST
Example: int myInts[10]; be type compatible. For example, a double value can
and int myInts[10][20]; not be assigned to an int variable.
1
4.3. Logical Operators OR
These are used to form compound Logical (Boolean)
expressions. They combine two conditions. The
exception is the negation operator. switch (expression)
{
Operator Meaning case value1: statementBlock1;
|| or break;
&& and case value2: statementBlock2;
! not or negation break;
case value3: statementBlock3;
5. Selection break;
..
To choose (select) between alternatives depending .
case valuen: statementBlockn;
on a condition. Sometimes there is no second
break;
alternative.
default: statementBlockDefault;
5.1. One alternative if }
if (condition)
{
statementBlock; Note that in the switch the value of expression MUST
} be of integral type (byte, short, int, long, char).