Let's get started with a program that reads a file!
- Login to your Repl.It account.
- Click on:
Languages
- In the
Popular
section choose: Java: A concurrent, class-based, statically typed object-oriented language.
- Click the
pencil
icon next to your repl name.
- In the
Default name:
input box type: ReadFile
- Delete all the lines of code provided as an example.
- Copy the
ReadFile.java
Template (Java) code (below)
- Paste that code into your new ReadFile class in the editor
- Change the
@author put-your-username-here
- Replace blank on line after the:
for (String item : teams) {
line with:
String[] strParts = item.split( ", " );
- Click on the
Add File (+)
icon.
- Name this file:
teams.txt
- Delete all the lines of code provided as an example.
- Copy the
GCP_Student.java
Template (Java) code (below)
- Paste that code into your new GCP_Student class in the editor
- Click the Run icon
ReadFile.java
Template (Java)
teams.txt
File (txt)
ReadFile
Class Output