i make a small program in java about Metro Station in Egypt so i specified the lines the passeger take a metro from it and the line they go to by boolean in default at classes boolean value is false but i want to make 4 variable changing in Main
this code specify the index of the stations in line 1 and make source1 true in the same time it works if i write it inline but when i write it in function always source1 is false as defualt and i can solve it please help
public void Searchinline1(String []line1,String sourceStation,String destinationStation,boolean source1,boolean destination1,int sourceindex,int destinationindex) {
    for (int i = 0; i < line1.length; i++) {
        if (sourceStation.equalsIgnoreCase(line1[i])) {
            source1=true;
            sourceindex=i;
        }
        if (destinationStation.equalsIgnoreCase(line1[i])) {
            destination1=true;
            destinationindex=i;
        }
    }
}
 
    