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;
10 Cards in this Set
- Front
- Back
Abstract class |
Private datatype variables; Constructor() {} abstract method(); |
|
Interface |
Abstract method(); |
|
Using an interface A on class B |
B implements A |
|
Using an abstract class A on class B |
B extends A |
|
Using an abstract class A, an interface B on a class C |
C extends A implements B |
|
Writing to file syntax |
- new PrintWriter object with new FileOutputStream object, (set to true to not append). - in try catch block PrintWriter object method write(). String filename = "example.txt"; PrintWriter outputStream = null; try{ outputstream = newPrintWriter( new FileOutputStream(filename, true)); outputStream.write("example"); } catch (FileNotFoundException e) { S.o.p(e); } |
|
BufferedReader syntax |
import java.io*; WITHIN TRY / CATCH - new file Object. New BufferedReader object with reference to new FileReader object. While loop with condition new string equal to br.readLine() is not null
try{ File file = new File("example.txt");
BufferedReader br = new BufferedReader (new FileReader(file));
String st; while((st = br.readLine()) != null) s.o.p(st); } catch (IOException e) {sop(e);} |
|
Scanner for reader text file |
import java.io*; WITHIN TRY/CATCH BLOCK new file Object with relative file path New scanner object with file Object While loop with condition method scanner.hasNextLine(). Sop(scanner.nextLine(); close scanner
E.g. try { File file = new File("example.txt"); Scanner scanner = new Scanner(file);
while (scanner.hasNextLine()) s.o.p(scanner.nextLine()) scanner.close() } catch (IOException e) {s.o.p(e);} |
|
Recursion |
When a method calls itself |
|
Recursive steps |
What is the repeated method? Exit condition |