Looks like no one added any tags here yet for you.
Why do we use Java?
Java is object oriented — models the real world, greater flexibility, modularity, and reusability
What do object oriented languages allow for?
inheritance
what is an object
a specific concrete representation of a class
what is instantiation
the creation of an instance/object from a class; creating a concrete representation of a class (aka initialization)
What are the types of programs in java?
Standalones
does not need internet browser
needs a main method
Applets
does not need main method
can be executed through a network browser and use a GUI class library
What are the naming conventions for a class?
Every first letter of the word must be capitalized (e.g. HelloWorld)
what is the process of java?
storage, input, process, output
What are the primitive data types?
boolean (1 bit)
char (16 bits)
byte (8 bits)
short (16 bits)
int (32 bits)
long (64 bits)
float (32 bits)
double (64 bits)
what is the function and size of boolean
true or false; 1 bit
what is the size of char?
16 bits
what is the function and size of byte?
integer; 8 bits
what is the function and size of short?
integer; 16 bits
what is the function and size of int?
integer; 32 bits
what is the function and size of long?
integer; 64 bits
what is the function and size of float?
decimal; 32 bits
what is the function and size of double?
decimal; 64 bits
what are the naming conventions for variables?
Capitalize first letter of every word except for the first word (e.g. startingNumber)
what are the naming conventions for methods?
Capitalize first letter of every word except for the first word (same as variables)
what are the naming conventions for constants?
the word “final”(lowercase) followed by the type, followed bu the name of the constant in all caps (e.g. final double PI =3.14)
why are constants important?
it minimizes memory
makes things more efficient/run faster by optimizing memory
think: video games
what is casting?
casting means explicitly telling Java to make a conversion
when is casting required?
when you want to perform a narrowing conversion
what is important to know about a narrowing conversion?
narrowing runs the risk of losing information
what are the 2 rules for casting of primitive data types?
you may cast any non-boolean type to any other non-boolean type
you may NOT cast a boolean type to any other type or vice versa
what are the three types of loops common to any programming language?
counted loops, conditional loops, and infinite loops
what are the three types of loops in Java?
for loops, while loops, and do while loops
when should you use a counted loops?
when you know how many times you want something to loop
when should you use conditional loops?
when you don’t know how many times you want something to loop
what is the difference between a while loop and a do while loop?
while loops give the user an option to enter the loop or not (condition occurs at the beginning of the loop), and do while loops force the user to enter the loop at least once (condition occurs at the end of the loop)
what are the parts of a for loop?
initialization, test/exit condition, increment/decrement
what is the symbol for less than?
<
what is the symbol for less than or equal to?
<=
what is the symbol for greater than?
what is the symbol for greater than or equal to?
=
what is the equality operator symbol for equals?
==
what is the symbol for not equal?
!=
what is the logical operator symbol for “and”?
&&
what is the logical operator symbol for “or”?
||
what is the difference between = and ==
“=” is used to assign value, and “==” is a relational operator for comparing
what does x+=y mean?
x=x+y
what does x-=y mean?
x=x-y
what does x*=y mean?
x=x*y
what does x/=y mean?
x=x/y
what does y=x++ mean?
y=x+1 (x is incremented after)
what does y=++x mean?
y=x+1 (x is incremented before)
what is selection?
a method used to make choices based on conditions
what is switch case selection used for?
it’s useful for things like menu selection where each choice/outcome is associated with an integer value
what are the limitations of switch case?
the expression of a switch statement must be int or char (integral type)
it can’t be boolean or any other type
switch case cannot perform relational checks
what are the parts of the software design process?
problem definition
list of identifiers/analysis
algorithm/design
coding/implementation
testing and debugging
maintenance
how many lines can be written in an if statement without brackets?
one line
what is the difference between parsing and casting?
parsing is converting from string (you don’t risk losing any information), and casting is the narrowing or widening of primitive data types in which you risk losing information if you do a narrowing conversion
what is commenting used for?
used to explain your logic and make the program easier to follow/understand
what is a class?
a class is a generic template for a set of objects with similar features