java - Reading file and defining lines and elements? -



java - Reading file and defining lines and elements? -

i'm trying assign rows capitalized alphabets , columns little alphabets, sec while statement not print reason

fyi tried assigning rows numbers couldn't assign int strings.

the txt file consists of : *without spaces between lines

abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyz

and possiable alter element if given specific row , column?

thank in advance.

edit: in main class phone call methods in class.

package archmap; import java.io.*; import java.util.*; public class readfile { private scanner reader; scanner vari = new scanner(system.in); public void openfile(){ seek { system.out.print("enter file location"); string y = vari.nextline(); reader = new scanner(new file(y)); }catch(exception e){ system.out.println("error!!"); } } public void readfile(){ while(reader.hasnextline()){ string = reader.nextline(); string b = reader.nextline(); string c = reader.nextline(); string d = reader.nextline(); string e = reader.nextline(); system.out.printf("this line print\n"); system.out.printf("%s\n%s\n%s\n%s\n", a, b, c, d,e); break; } while(reader.hasnext()){ string = reader.next(); string b = reader.next(); string c = reader.next(); string d = reader.next(); string e = reader.next(); system.out.printf("\ncharacter print "); system.out.printf("%s\n%s\n%s\n%s\n", a, b, c, d,e); break; } } public void close(){ reader.close(); } }

java arrays file

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -