Programming Basics Flashcards
What does the term ‘white space’ mean?
The term white space refers to one of more consecutive space characters, tab characters, or line breaks.
What is a block?
A block is a group of one or more statements that’s enclosed in braces.
What is an identifier?
An identifier is a word that you make up to refer to a Java programming element by name.
What is the state of an object?
The state of an object consists of any data that the object might be keeping track of.
What is the behavior of an object?
The behavior of an object consists of actions that the object can perform.
What does the static keyword mean?
It means that you can call a method without first creating an instance of a class, because static methods are called from classes, not objects.
Creating an object from a class
ClassName variableName = new ClassName(Paramater-list);
Importing Java classes.
import package.class.method;
What is a class variable?
A class variable is a variable that any method in a class can access, including static methods such as main.
What is a local variable?
A local variable is a variable that’s declared within the body of a method.
What is a final variable?
A final variables, also called a constant, is a variable whose value you can’t change after it’s been intialized. To declare a final variable you must use the final keyword. Ex) final int WEEKDAYS = 5;
What are primitive types?
Primitive types are the data types defined by the language itself.
What are reference types?
Reference types are types defined by classes in the Java application programming interface, or by classes you create rather than by the language itself.
What is an integer?
An integer is a whole number that is, a number with no fractional or decimal portion.
What value can an integer hold?
Any value from -2 billion to +2 billion
What value can a byte hold?
Any valye from -128 to +128
What value can a short hold?
Any value from -32,687 to +32.687
What value can a long hold?
Any value from -9,000 trillion to +9,000 trillion
How many decimal points can a float type hold?
6 to 7 decimal points
How many decimal points can a double hold?
Aboout 15 digits
Primitive Data Types
int, short, long, byte, float, double, char, boolean
What is a decrement operator?
– subtracts 1 from the value
What is an increment operator?
++ adds 1 to the value
What is a while loop?
A loop that executes continuously as long as some conditional expression evaluates to true
What is a do-while loop?
A do-while loop is similar to a while loop, but with a critical difference: In a do-while loop, the condition that stops the loop isn’t tested until after the statements in the loop have been executed.