Java Course Day 3
-
Upload
oleg-yushchenko -
Category
Education
-
view
559 -
download
1
Transcript of Java Course Day 3
Day 3
static
null reference
Java Arrays
Type[] arrayName = new Type[elements count];
int[] array1 = new int[10];
String[] array1 = new String[10];
Object[] array1 = new Object[10];
MyType[] array1 = new MyType[10];
String[] colors = new String[] {“red”, “blue”, “white”};
How To Access Elements?
String[] friends = new String[10];
friends[0] = “Oleg”;
friends[1] = “Alex”;
friends[3] = “Irina”;
System.out.println(friends[1]);
System.out.println(friends[3]);
Multidimensional arrays
Type[][] arrayName = new Type[rows count][columns count];
Java Loops
while (condition) { ….}
do { ….} while (condition);
for (counter; condition; increment) { ….}
Goals
Packages
(Private, Protected, Public, default)Access Levels
Private – this class only
Protected – this class and children
Public – no limits
default – package private
Encapsulation
final
Interfaces
Class casting
Never, Never, Never, Never Give Up!