Write a program that receives a character and a character string as arguments. The program should read the text file whose name has been received as the second argument and display on the screen those lines that contain the character indicated as the first argument.
I'm stuck and I do not know how to raise it in java.
import java.io.*;
class LeeFichero {
public static void main(String [] arg)
{
File archivo = null;
try {
archivo = new File("archivo.txt");
String linea;
FileReader fr = new FileReader (archivo);
BufferedReader br = new BufferedReader(fr);
int i,j,aux=0;
while((linea=br.readLine())!=null) {
for(i=0;i<linea.length();i++)
{
if(linea.charAt(i)=='a')
{
if(i==0)
aux=1;
else
{
if(linea.charAt(i-1)==' ')
aux=1;
}
}
if(aux==1)
{
if(linea.charAt(i)!=' ')
System.out.print(linea.charAt(i));
else
{
aux=0; System.out.println(' ');
}
}
}
}
fr.close();
}
catch(IOException a){
System.out.println(a);
}
}
}
This is my exercise, I have raised it which takes out all the words that begin with a, but what I want to do is to tell me where in which lines is the a how can I modify it