What's new

Help (JAVA) PATULONG PANO MAG MATCH NG TXT FILE!!!

Nero Swallowtail

Eternal Poster
Joined
Aug 13, 2020
Posts
465
Reaction
174
Points
280
so ganto kase dapat, ata, ewan ko kung possible to sa java, gumagawa po kase kami ng log in at sign up interface, bale pag nag sign up ka, ma i store ung i iinput mo sa isang file using IO Class, ang problema ko is kapag dalawang accounnt yung ginawa di tapos tinype ko ung naunang account na naka store sa txtfile di nababasa ni java, ung latest account lang ang na sa save, di ko kase kabisado tong IOClasses so di ko alam ibabato kong condition para mabasa nya ung file, pa help po please, kanina pa po kase deadline nakiusap nalang ako sa sir namin hehe
eto po ung code:
You do not have permission to view the full content of this post. Log in or register now.
 
ay mag e error pala yan sainyo, eto ung code para dun sa InvalidLetterException

Java:
public class InvalidLetterException extends Exception{
    public InvalidLetterException() {
          super("Invalid  Letter Detected");
    }
}
 
Check nyo po subukan nyo print yung get result ng login nyo bka di lng na detect yung sunod na strings.

First to do.
Get the strings from txt file.

Try to print values to console to check if line is detected.

create a String model to store arrays of strings.
match the stored string arrays using for loop.
 
File file = new File("abc.txt");
FileInputStream fin = new FileInputStream(file);
BufferedReader reader = new BufferedReader(fin);

List<String> list = new ArrayList<String>();
while((String str = reader.readLine())!=null){
list.add(str);
}

//convert the list to String array
String[] strArr = Arrays.toArray(list);


(Match Everything from created arrays)
private String[] toppings = {"Cheese", "Pepperoni", "Black Olives"};

// our constructor; print out the String array here
public JavaStringArrayTests1()
{
// old for loop
int size = toppings.length;
for (int i=0; i<size; i++)
{
System.out.println(toppings);
}
}
 
Last edited by a moderator:

Similar threads

Back
Top