java - Using scanner to read string from text file and then print out -
I have a text file that has a string, - Any help would be appreciated thanks! code, to use a word to read just before the scanner. The whole line .. "! - ========= == All the objects in classes: FunctioningFrages: Detelad =========== " In this as you can see in the code below. If there is this string in the text file, then I need to read it from the text file and then print it again. The problem is that I can not do that work, why my code is not printing.
public class Main {public static void main (String [] AGR) file throws Notfound Akspesheshn (File = new File ( "C: / Users / Anton / Pictures / 1 x Jiotronsform. 5m. cinematography "txt); Scanner scan = new Scanner (file); while (ScankhasNext ()) {string str = scan.next (); if (str =="! - ======= ==== all purposes in the classroom: Fasisreshnsfas: Diteelad =========== ") {System.out.print (str);}} scan.close ();}} < / pre>
Scanner scan = new Scanner (file); string str1 = scan.nextLine (); if (str1.equals ( "! - all objectives =========== class: Fasisreshnsfas: Diteyld ========= == ")) System.out.println (str1); scan.close ();
Comments
Post a Comment