Ok so first off hello all and thanks in advance for your help. Ok so I've done some research with regards to the error messages I'm getting and I've checked all my curl braces so i don't know what could be wrong with. Anyways I'm writing code to emulate the enigma machine from WWII, part of the assignment is to read the inputs from a file already created. Now I know I'm missing some code here but I have absolutely no idea what is wrong with the program because I'm getting the errors all over the place.

9 errors found:
File: C:\Users\PJ\Downloads\enigma.java [line: 19]
Error: C:\Users\PJ\Downloads\enigma.java:19: illegal start of type
File: C:\Users\PJ\Downloads\enigma.java [line: 19]
Error: C:\Users\PJ\Downloads\enigma.java:19: illegal start of type
File: C:\Users\PJ\Downloads\enigma.java [line: 19]
Error: C:\Users\PJ\Downloads\enigma.java:19: ')' expected
File: C:\Users\PJ\Downloads\enigma.java [line: 19]
Error: C:\Users\PJ\Downloads\enigma.java:19: ';' expected
File: C:\Users\PJ\Downloads\enigma.java [line: 19]
Error: C:\Users\PJ\Downloads\enigma.java:19: <identifier> expected
File: C:\Users\PJ\Downloads\enigma.java [line: 19]
Error: C:\Users\PJ\Downloads\enigma.java:19: ';' expected
File: C:\Users\PJ\Downloads\enigma.java [line: 26]
Error: C:\Users\PJ\Downloads\enigma.java:26: 'else' without 'if'
File: C:\Users\PJ\Downloads\enigma.java [line: 32]
Error: C:\Users\PJ\Downloads\enigma.java:32: <identifier> expected
File: C:\Users\PJ\Downloads\enigma.java [line: 37]
Error: C:\Users\PJ\Downloads\enigma.java:37: class, interface, or enum expected

import java.awt.*;
import java.awt.font.*;
import java.text.*;
import java.util.*;
import java.util.List;

public class reader
{
  
String fileName = FileChooser.pickAFile();
FileInputStream in = new FileInputStream(fileName);
BufferedReader br = new BufferedReader(new InputStreamReader(in));

String strLine;
String[] myarray;
string myarray = new String[20];
  

if((strLine = br.readLine()) != " ")
{  
for (int j = 0; j < myarray.length; j++)
{
myarray[j] = br.readLine();
system.out.prntln(myarray[j]);
}
else
{
  j++;
}
    
}
in.close();


}

public static void main(String args[])
{
  
}

Thanks again for your help!

String[] myarray;
string myarray = new String[20];

`string` is the unknown type here; I think you'd want something like:

String[] myarray = new String[20];

Also, you are missing a closing brace for the `if` statement and an extra brace after the `else` statement. Indenting your code might help you out when it comes to missing/misplaced braces.

I'd recommend reading the Java beginner tutorials and starting off with small programs to get a hang of the language and its syntax.

also, you'll need to learn where to put your code ..
that if structure should be within the main method

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.