CyberSlug Rules!

Beginner Programming CMPS060

Prof. Paulo Franca

Home

Syllabus

Login

Objects

Download

Staff only

Declaration

variables are declared in the same way as objects:

<type> <variable name>;

optionally, you may assign a value (initialization):

<type> <variable name> = <value>;

variables and objects must be declared before being used;

variables have "type", objects have "class";

examples:

int number, howmany=2;
float x=2.34,y=0.;
athlete sal;