• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/5

Click to flip

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;

5 Cards in this Set

  • Front
  • Back
Reading input from an external file into an array1
import java.util.*;
import java.io.*;
public class ...
{
public static void main(String[] args)
{
File fnam = new File(“C:\\temp\\data.txt”);
if (!fnam.exists())
System.out.println(“File not found”);
else
{
Scanner inFile = new Scanner(fnam);
int[] array = new int[10];
int I = 0;
while (inFile.hasNext())
{
array[i] = inFile.nextInt();
i++;
}
inFile.close();
test2
import java.util.*;
import java.io.*;
public class ...
{
public static void main(String[] args)
{
File fnam = new File(“C:\\temp\\data.txt”);
if (!fnam.exists())
System.out.println(“File not found”);
else
{
Scanner inFile = new Scanner(fnam);
int[] array = new int[10];
int I = 0;
while (inFile.hasNext())
{
array[i] = inFile.nextInt();
i++;
}
inFile.close();
test3
import java.util.*;
import java.io.*;
public class ...
{
public static void main(String[] args)
{
File fnam = new File(“C:\\temp\\data.txt”);
if (!fnam.exists())
System.out.println(“File not found”);
else
{
Scanner inFile = new Scanner(fnam);
int[] array = new int[10];
int I = 0;
while (inFile.hasNext())
{
array[i] = inFile.nextInt();
i++;
}
inFile.close();
test5
import java.util.*;
import java.io.*;
public class ...
{
public static void main(String[] args)
{
File fnam = new File(“C:\\temp\\data.txt”);
if (!fnam.exists())
System.out.println(“File not found”);
else
{
Scanner inFile = new Scanner(fnam);
int[] array = new int[10];
int I = 0;
while (inFile.hasNext())
{
array[i] = inFile.nextInt();
i++;
}
inFile.close();
test6
import java.util.*;
import java.io.*;
public class ...
{
public static void main(String[] args)
{
File fnam = new File(“C:\\temp\\data.txt”);
if (!fnam.exists())
System.out.println(“File not found”);
else
{
Scanner inFile = new Scanner(fnam);
int[] array = new int[10];
int I = 0;
while (inFile.hasNext())
{
array[i] = inFile.nextInt();
i++;
}
inFile.close();