Section 1

Preview this deck

catch (FileNotFoundException e)

Front

Star 0%
Star 0%
Star 0%
Star 0%
Star 0%

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Active users

0

All-time users

0

Favorites

0

Last updated

6 years ago

Date created

Mar 1, 2020

Cards (7)

Section 1

(7 cards)

catch (FileNotFoundException e)

Front

catch

Back

if (name1.compareTo(name2)<0) s.o.pln(name1+ "is less than " name2);

Front

compare string 2

Back

Import java.io.*; PrintWriter pw= new PrintWriter("foo.txt"); ← file name pw.println("Hello"); pw.close();

Front

write stuff to files

Back

Perform the initialized expression Evaluate test expression. If true, go to step 3. If not, terminate loop. Execute body of loop. Perform update expression, then go back to step 2.

Front

operations for forloop

Back

If (name1.equals(name3)) s.o.pln(name1 + " and " + name3 + " are the same.")

Front

compare string 1

Back

file file= new File(MyFile.txt) Scanner inputFile = newScanner(file);

Front

try

Back

Pretest loop→ Tests loop condition BEFORE executing loop's body. Body only executed when expression is deemed true. Loop continues to iterate as long as condition is true, ends when condition becomes false. While & for loops are examples of pretest loops. Posttest loop→ Tests loop condition AFTER executing loops' body. Body is executed prior to evaluating expression. If condition is true, loop continues to next iteration. Do-while loop is example of posttest loops.

Front

Pretest and posttest loop

Back