Comprog2 Flashcards
java history
- created by James Gosling
- green team
- green project
- in 1991 (Sun Microsystems)
- initially called “oak” (in honor for the tree outside Gosling’s window)
java characteristics
simple
object-oriented
distributed
architecture neutral
portable
high-performance
interpreted
robust
secure
multi-threaded
dynamic
program’s source file?
compile-time environment
program’s class file?
run-time environment
parts of Java’s simple code
multi-line comment
package name
class header
main method
program body
simple code interpretation
/*
*
*/
package unes;
public class Unes {
public static void main (String [ ] args) {
System.out.println(“Hi”);
}
}
what is a variable?
an item of data used to store state of objects
a variable has?
a data type and a name
these are case-sensitive
variable names
it may be letters, digits, dollar signs, or underscore characters
subsequent characters
if the name you choose consists of only one word, spell that word in?
all lowercase letters
java primitive data types
logical - Boolean
textual - char
integral - byte, short, int, and long
floating point - float and double
they represent simple values that have built-in functionality in the language
primitive data types
they represent simple values such as numbers, Booleans, and characters
primitive data types
name of place in memory that can contain data
variable
kind of data variable can contain
data type
identifier that refers to the variable
name
the default or specified value
value
also called the literal of the statement
value
all Java statements end with a?
semicolon ;
how to declare a variable?
data type name;
int grade;
double ave1, ave2;
boolean isVerified;
= is called?
an assignment operator
== is called?
a comparative equals
if variable is not initialized, most will default to ____. All variables should be initialized
null
operators in java
arithmetic operators
relational operators
logical operators
assignment operators
string operator
used in mathematical expressions in the same way that they are used in algebra
arithmetic operators