Use LEFT and RIGHT arrow keys to navigate between flashcards;
Use UP and DOWN arrow keys to flip the card;
H to show hint;
A reads text to speech;
12 Cards in this Set
- Front
- Back
- 3rd side (hint)
The program container |
Program name declared followed by class keyword-{} =all program code that is defined will be btwn these brackets |
The start of the program |
|
Main method- starting point of nearly all java programs public static void main (String []args) { } |
" main" Contains the actual program instructions |
|
|
Public static void-keywords |
Defines how the method may be used |
|
|
(String [] args) |
Useful when passing values |
|
|
The statement |
System.out.println ("Hello world"); Statements perform program task |
|
|
Variables |
Useful container which a value may be stored |
|
|
Create a variable |
By writing a variable declaration in the program .ie String message; May only begin with a letter,dollarsign ($),or underscore (_) Names are case sensitive Variable -avoid java keywords. |
Key words: |
|
Constants |
Are a variable that cannot be changed-a fixed value ie all caps_TOUCHDOWN |
|
|
Integers primitave data types: Java programming language is statically-typed, which means that all variables must first be declared before they can be used. |
byte,short,long,double(floating) ,float, int,Boolean char Byte: The byte data type is an 8-bit signed two's complement integer. It has a minimum value of -128 and a maximum value of 127 (inclusive). The byte data type can be useful for saving memory in large arrays, short: The short data type is a 16-bit signed two's complement integer. It has a minimum value of -32,768 and a maximum value of 32,767 (inclusive). int: By default, the int data type is a 32-bit signed two's complement integer, which has a minimum value of -231 and a maximum value of 231-1. In Java SE 8 and later, you can use the int data type to represent an unsigned 32-bit integer, which has a minimum value of 0 and a maximum value of 232-1 long: The long data type is a 64-bit two's complement integer. The signed long has a minimum value of -263 and a maximum value of 263-1. float: The float data type is a single-precision 32-bit IEEE 754 floating point. Its range of values is beyond the scope of this discussion, but is specified in the Floating-Point Types, Formats, and Value boolean: The boolean data type has only two possible values: true and false. Use this data type for simple flags that track true/false conditions. char: The char data type is a single 16-bit Unicode character. It has a minimum value of '\u0000' (or 0) and a maximum value of '\uffff' (or 65,535 inclusive). |
|
|
String data type |
String String greeting = "Hello world!"; System.out.print("hello world"); |
|
|
VARIEBLES |
Declaring a variable example: Int numDays; Intializing a varieble example: Int numdays = 3; Scope: Variable scope refers to the accessibility of a variable.The rule 1 is that variables defined in a block are only accessible from within the block. The scope of the variable is the block in which it is defined. For example, consider the following for statement.ie. public class MainClass { public static void main(String[] args) { for (int x = 0; x < 5; x++) { System.out.println(x); } } } |
|
|
Arithmetic |
Arithmetic*= mutiply+= add- = minus/= division does not give remainder% = modulo = gves remainder++ = increment-- = decrementOrder of Operations: Operator Precedence Operators Precedencepostfix expr++ expr--unary ++expr --expr +expr -expr ~ !multiplicative * / %additive + -shift << >> >>>relational < > <= >= instanceofequality == !=bitwise AND &bitwise exclusive OR ^bitwise inclusive OR |logical AND &&logical OR ||ternary ? :assignment = += -= *= /= %= &= ^= |= <<= >>= >>>= |
|