Level 41 Level 43
Level 42

[Quiz] Building Blocks


29 words 0 ignored

Ready to learn       Ready to review

Ignore words

Check the boxes below to ignore/unignore words, then click save at the bottom. Ignored words will never appear in any learning session.

All None

Ignore?
Typical Program Structure
1.) Input some data
Identifiers
are names of things, such as variables, constant, methods and classes
Identifier Rules
Must start with a "Java letter"
Block Comments
Can span several lines.
Line Comments
Start with //
Data types
Describes the type of information stored in a variable or object.
byte
eight bits
short
16 bits long. 16 bit integer (-32K - 32K)
Int
If there is a method "sum(int x, int y)", what is the return type?
long
64 bits long 64 bit intiger
float
32 bits long. 32bit FLOATING POINT
Double
64 bits long. 64bit FLOATING POINT
Char
Data type indicative of a single symbol
Boolean
Binary data type
+
Additive operator (also used
-
Type the Subtraction operator
*
multiplication
/
division
%
Remainder-Divides left hand operand by right hand operand and returns remainder
Instructions and data.
A program has two elements, what are they?
Classes, methods, and data.
Identifiers are symbolic names for what?
What is the basic building block of a Java program?
The statement. A statement is terminated with a semicolon and can span several lines.
What are white space characters?
The space, tab, newline, and carriage return. Any amount of white space is permitted between identifiers, Java keywords, operands, operators, and literals.
A block consists of what?
0 or more statements. They start with a left curly brace and end with a right curly brace. Blocks can be used anywhere in the program that a statement is legal.
Block comments are delineated by /* and */
Comments are ignored by the compiler. How are block comments and line comments delineated?
Java supports eight primitive data types. What are they?
Double, float, long, int, short, byte, char, and boolean.
Variables must be declared before they are used. What does this mean?
Declaring a variable is specifying the data item's identifier and data type. The syntax for declaring a variable is:
How should variable names be written?
They should begin with a lowercase letter; if they consist of more than one word, each word after the first should begin with a capital letter. There should never be spaces.
Four; int, short, long, and byte.
An integer data type is one that evaluates to a positive or negative whole number. How many integer data types does Java recognise?