Java Unit 1 Flashcards
These rules specify the basic vocabulary of the language and how programs can be constructed using things like loops, branches, and subroutines.
Syntax
A set of rules that determine the meaning of a program written in a language.
Semantics
Java programs are compiled into what?
Byte code!
What is a subroutine call statement?
A subroutine call statement is a predefined set of routines for a subroutine to complete.
Example: System.out.println is a subroutine.
In order to define a program, a class must include a subroutine named?
main
public static void main(String[] args) {
statements
}
Why do you have to type “public” in the first line of main()?
Using “public” means that the routine can be called from outside of the program.
A subroutine can’t exist by itself. What does it HAVE to be a part of?
A class
What is a package?
A group of classes.
To execute a program, you only need the compiled “ “ file, not the source code.
class
When defining a variable, capitalizing every word except the first is referred to as what?
Camel case
These names consist of several simple names separated by periods.
Compound names, also called qualified names.
Example: System.out.println
An “ “ represents anything that refers to or computes a data value.
expression
Name all of the primitive types. Hint: there are 8
- byte - 16 bits
- short
- int - 32 bits
- long - 64 bits
- float
- double
- char
- boolean
What kind of numbers do float and double types hold?
real numbers
What range of values can a byte type hold?
Anywhere from -128 to 127 which equals up to 256 integers.
What range of values can a short type hold?
From -32,768 to 32,767 (16 bits)