Basic Java Program Flashcards
Identifier:
A name given to an item in your program.
- must start with a letter or _ or $
What are examples of legal names for a program?
- _myName
- TheCure
- ANSWER_IS_42
- $bling$
What are examples of illegal names for a program?
- me+u
- 49ers
- side-swipe
- Ph.D’s
List out keywords in java that cannot be used as an identifier (a - c):
- abstract
- boolean
- break
- btye
- case
- catch
- char
- class
- const
- continue
List out keywords in java that cannot be used as an identifier (d - g):
- default
- do
- double
- else
- extends
- final
- finally
- float
- for
- goto
List out keywords in java that cannot be used as an identifier (i - n):
- if
- implements
- import
- instanceof
- int
- interface
- long
- native
- new
List out keywords in java that cannot be used as an identifier (p - s):
- package
- private
- protected
- public
- return
- short
- static
- strictfp
- super
- switch
- synchronized
List out keywords in java that cannot be used as an identifier (t - w):
- this
- throw
- throws
- transient
- try
- void
- volatile
- while
define escape sequence:
A special sequence of characters used to represent certain special characters in a string.
\t represents:
tab character
\n represents:
new line character
" represents
quotation mark character
\ represents
backslash character
What are the two ways to make comments in a code?
- //
2. /* (to start) and */ (to end)
define type:
A category or set of data values
define int:
integers to 2^31
Examples:
42, -3, 0, 926394
define double:
real numbers to 10^308
Examples:
3.1, -0,25, 9, 9.4