Menu
Menu
DaniWeb
Log In
Sign Up
Read
Contribute
Meet
Search
Search
About 831 results for
hasnextline
- Page 1
Checking hasNextLine() for a file scanner
Programming
Software Development
15 Years Ago
by dmanw100
… = new File(fileName); Scanner dataFile = new Scanner(playerFile); while(dataFile.
hasNextLine
()) [/CODE] Why would datafile…
Re: Checking hasNextLine() for a file scanner
Programming
Software Development
15 Years Ago
by dmanw100
… Scanner dataFile = new Scanner(playerFile); //new Scanner dataFile while(dataFile.
hasNextLine
()) //while there is a next line { Player temp = new Player…
Re: Checking hasNextLine() for a file scanner
Programming
Software Development
6 Years Ago
by Rafael_9
In my experience,
hasNextLine
( ) goes crazy when the Scanner is created with `new Scanner (new File(...))` and there are non-ascii characters in the file (such as á, ñ, ..). As suggested, by creating the Scanner `new Scanner (new FileInputStream(...))` the problem disappears.
Help with my GroupProgram
Programming
Software Development
12 Years Ago
by cloud02
… called intns */ public void readFile(){ int index = 0; while (reader.
hasNextLine
()){ String[] temp = reader.nextLine().split(", "); // Store the… void checkInside(int number) throws Exception { String count; if ( scan.
hasNextLine
() == false ) { count = Integer.toString(number); FileWriter out = new …
Re: Help with my GroupProgram
Programming
Software Development
12 Years Ago
by cloud02
…called intns */ public void readFile(){ int index = 0; while (reader.
hasNextLine
()){ String[] temp = reader.nextLine().split(", "); // Store … void checkInside(int number) throws Exception { String count; if ( scan.
hasNextLine
() == false ) { count = Integer.toString(number); FileWriter out = new…
Need help with the java code!
Programming
Software Development
15 Years Ago
by zantex
… { input = console.nextDouble(); // clear trailing newline from buffer if (console.
hasNextLine
()) console.nextLine(); return input; } catch (InputMismatchException e) { System.out.println…
reading from a txt file
Programming
Software Development
14 Years Ago
by polska03
…FileIO fio=new FileIO(s); while(fio.
hasNextLine
()) { if(fio.hasNextInt()==false){ throw new… not opened"); }else{ return scan.
hasNextLine
(); } }//
hasNextLine
public String getNextLine() throws Exception{ if(scan…
Stack Implementation
Programming
Software Development
13 Years Ago
by anirban007
…new FileReader("prefix.txt")); while(in.
hasNextLine
()) { prefix(in.nextLine()); } in.close();…"); in = new Scanner(fob); while(in.
hasNextLine
()) { String line = in.nextLine(); palindrome(line);…------Balanced Parenthesis check using Stack-----"); while(in.
hasNextLine
()) { String line = in.nextLine(); parenthesis(line…
Need Help With a Java Program That Will Indent Code From Another Java File
Programming
Software Development
7 Years Ago
by Brian_18
… Scanner jfile = new Scanner(new File(fileN)); while (jfile.
hasNextLine
()) { String text = jfile.nextLine(); if (text.contains("…new PrintStream(new File("words2.txt")); while (input.
hasNextLine
()) { String text = input.nextLine(); echoFixed(text, output);…
FileInput/Output Stream on JTextField
Programming
Software Development
13 Years Ago
by cathgodarve
…quot;\n"; storeAll1=storeAll1+temp1; } while(fr2.
hasNextLine
()) { String temp2=fr2.nextLine()+"\n"; …storeAll2=storeAll2+temp2; } while(fr3.
hasNextLine
()) { String temp3=fr3.nextLine()+"\n"; storeAll3…
Java - Arrays
Programming
Software Development
12 Years Ago
by saurabh2007
…]; int[] stdt; int[] answer = answerKey(); while (inScan2.
hasNextLine
()) { String id1 = inScan2.next(); ECHSid[temp] = id1…= inScan2.nextLine(); } String aa = inScan.nextLine(); while (inScan.
hasNextLine
()) { String id = inScan.next(); CitizenshipID[count] = id;…
Parsing a file for Sets and Maps
Programming
Software Development
12 Years Ago
by kweigand
…Scanner in = new Scanner(new File(filename)); while (in.
hasNextLine
()) { String agentNum = in.nextLine(); String sub = agentNum.… out = new PrintWriter("readfile.txt"); while (sc2.
hasNextLine
()) { Scanner s2 = new Scanner(sc2.next()); @SuppressWarnings("…
Need a Method That Will Split a Java File Into Lines By {, }, ;, and //
Programming
7 Years Ago
by Brian_18
…new PrintStream(new File("words2.txt")); while (input.
hasNextLine
()) { String text = input.nextLine(); echoFixed(text, output);…new PrintStream(new File("words2.txt")); while (input.
hasNextLine
()) { String text = input.nextLine(); echoFixed(text, output); …
TicTacToe equivalent with a twist using socket programming in Java
Programming
Software Development
4 Years Ago
by M_27
…private void processCommands() { while (input.
hasNextLine
()) { var command = input.nextLine(); … private void processCommands() { while (input.
hasNextLine
()) { var command = input.nextLine(); …
Hey check out my prog. It has an error can u find it?
Programming
Software Development
18 Years Ago
by buggytoast
… Scanner in = new Scanner(inFile); while (in.
hasNextLine
()) { Scanner lineScanner = new Scanner(in.nextLine());… Scanner in = new Scanner(inFile); while (in.
hasNextLine
()) { Scanner lineScanner = new Scanner(in.nextLine()); lineScanner…
Source Code that don't work?
Programming
Software Development
18 Years Ago
by buggytoast
… Scanner in = new Scanner(inFile); while (in.
hasNextLine
()) { Scanner lineScanner = new Scanner(in.nextLine());… Scanner in = new Scanner(inFile); while (in.
hasNextLine
()) { Scanner lineScanner = new Scanner(in.nextLine()); lineScanner…
Stuck: Exception Handling and reading text from file
Programming
Software Development
15 Years Ago
by LevelSix
… number of words */ public int getWordCount() { while (in.
hasNextLine
()) { for(int i = 1; i <= in.nextLine…the number of lines */ public int getLineCount() { while (in.
hasNextLine
()) { lines++; } return lines; } /** Gets the number of…
Re: Stuck: Exception Handling and reading text from file
Programming
Software Development
15 Years Ago
by LevelSix
…boolean done = false; while (!done) { if (in.
hasNextLine
() == true) { for(int i = 1; i …() { done = false; while (!done) { if(in.
hasNextLine
()) lines++; else lines = 0; } return lines; }…
Re: Stuck: Exception Handling and reading text from file
Programming
Software Development
15 Years Ago
by LevelSix
…(reader); boolean done = false; while (!done) { if (in.
hasNextLine
() == true) { lines++; while(in.
hasNextLine
()) { int j = 0; int i = 1; file = in…
Re: Stuck: Exception Handling and reading text from file
Programming
Software Development
15 Years Ago
by LevelSix
…done = false; while (!done) { while(in.
hasNextLine
()) { lines++; int j = 0; int i…num = array.length; chars += num; if(in.
hasNextLine
() == false) done = true; } } }…
Re: Stuck: Exception Handling and reading text from file
Programming
Software Development
15 Years Ago
by sayedjustetc
… number of words */ public int getWordCount() { while (in.
hasNextLine
()) { for(int i = 1; i <= in.nextLine…the number of lines */ public int getLineCount() { while (in.
hasNextLine
()) { lines++; } return lines; } /** Gets the number of…
Re: Stuck: Exception Handling and reading text from file
Programming
Software Development
15 Years Ago
by LevelSix
…done = false; while (!done) { while(in.
hasNextLine
()) { lines++; words++; int j = 0;…= array.length; chars += num; if(in.
hasNextLine
() == false) done = true; } }…
Error Scanner Loading
Programming
Software Development
14 Years Ago
by killerqb
… URL(filename); load1 = new Scanner(theFile.openStream()); while (load1.
hasNextLine
()) { String tempName = load1.nextLine(); while (tempName.length() …); try { Scanner load = new Scanner(theFile1); while (load.
hasNextLine
()) { String tempName = load.nextLine(); while (tempName.length() …
Linear and Binary Search not working! :(
Programming
Software Development
14 Years Ago
by clem998
…("unsorted.txt")); int loc = 0; while(file.
hasNextLine
()){ s[loc++] = file.nextLine(); } System.out.println("…("sorted.txt")); int loca = 0; while(file2.
hasNextLine
()){ j[loca++] = file2.nextLine(); } System.out.println("…
Not Counting spaces
Programming
Software Development
14 Years Ago
by vampgirl13
…(file); //Reads the lines off the file while (scan.
hasNextLine
()) { if (scan.
hasNextLine
()) { String line = scan.nextLine(); myCollection.add(line); } } // Prints out…
Java tuturia printing a string in reverse from file using while loop and IO try/catch
Programming
Software Development
13 Years Ago
by jamesonh20
…= new Scanner(myReader); while (myScanner.
hasNextLine
()){ String textLine = myScanner.nextLine(); System… new Scanner(myReader); while (myScanner.
hasNextLine
()){ String textLine = myScanner.nextLine();…
[beginner] About Class Input
Programming
Software Development
13 Years Ago
by geasssos
…;false</code> otherwise. */ public boolean
hasNextLine
() { boolean returnValue = false; try { returnValue = scanner.
hasNextLine
(); } catch (IllegalStateException e) { illegalStateExceptionHandler(); } return returnValue; } /** * @return…
Assignment- multiple errors (using else if statements)
Programming
Software Development
12 Years Ago
by compuser
… line = null; boolean done = false; if(!in.
hasNextLine
()) { done = true; } else { line = in…out.println("Error: command invalid"); } if(!in.
hasNextLine
()) { done = true; } else { line = …
"Cannot find symbol" compilation error
Programming
Software Development
12 Years Ago
by jaxi
… = new Scanner(courseList); //scan lines in File while(courseScanner.
hasNextLine
()) { //get name and start/ end times String cName =… cStart, cEnd); courses.add(newCourse); //skip blank line if(courseScanner.
hasNextLine
()) courseScanner.nextLine(); } } public void fit() throws NumberFormatException{ //sort…
Problem with DecimalFormat and variable type
Programming
Software Development
12 Years Ago
by jaxi
… = new Scanner(courseList); //scan lines in File while(courseScanner.
hasNextLine
()) { //get name and start/ end times String cName =… cStart, cEnd); courses.add(newCourse); //skip blank line if(courseScanner.
hasNextLine
()) courseScanner.nextLine(); } } public void fit() throws NumberFormatException{ //sort…
1
2
3
14
Next
Last
Search
Search
Forum Categories
Hardware/Software
Programming
Digital Media
Community Center
Latest Content
Newest Topics
Latest Topics
Latest Posts
Latest Comments
Top Tags
Topics Feed
Social
Meet People
Forums
Top Members
Community Functions
DaniWeb Premium
Newsletter Archive
Markdown Syntax
Community Rules
Developer APIs
Connect API
Forum API Docs
Tools
SEO Backlink Checker
Legal
Terms of Service
Privacy Policy
FAQ
About Us
Advertise
Contact Us
© 2024 DaniWeb® LLC