hi all,
I am having a problem reading the data from a text file into my array. it skips every other character and string in the text file
heres my code
import java.io.*;
import java.util.Scanner;
public class Morse
{
public static void main(String [] args) throws IOException
{
File file = new File("Morse.txt");
Scanner input = new Scanner(file);
String sentence;
char[] characters = new char[36];
String[] symbols = new String[36];
for(int i = 0; i < characters.length; i++)
{
for(int j = 0; j < symbols.length; j++)
{
char characs = input.nextLine().charAt(0);
String syms = input.nextLine();
characters[i] = characs;
symbols[i] = syms;
System.out.print(characters[i] + " " + symbols[i] + "\n");
}
}
}
}
and its returning this
1 2 ..---
3 4 ....-
5 6 -....
7 8 ---..
9 0 -----
A B -...
C D -..
E F ..-.
G H ....
I J .---
K L .-..
M N -.
O P .--.
Q R .-.
S T -
U V ...-
W X -..-
Y Z --..