Results 1 to 1 of 1
  1. #1
    karanhs6 is offline Member
    Join Date
    Oct 2010
    Rep Power

    Default Need help with delimeters and while loop

    Hello im new to java and i have a hw where i have to use delimeter and separate each word from url....and i cant use arrays so im kinda trapped
    i searched everywhere but i couldnt find any good solution
    well my url.txt file contents 2 lines
    XML Code:
    XML Code:
    and here is my code
    Java Code:
    import java.util.Scanner;
    public class scanfile
    		public static void main(String[] args) throws IOException
    	int k=0;
    	int z =0;
    		Scanner s,s2;
    		String l,p;
    		s= new Scanner(new File("url.txt"));
    		while (s.hasNext() == true)
    			l= s.nextLine();
    			s2=new Scanner(l);
    				while (s2.hasNext())
    				 // System.out.println(k+" "+p);
    						    while (p.charAt(z) == '@')
    the whole point of the program is to print the home team and after i compile it i get completly blank output....and i made sure the delimeter works by printing the words and length of the words between the delimeters

    so plzzzz help

    i kept working on it with the same code and i keep getting string index out of bound error...not the blank screen
    Last edited by karanhs6; 10-17-2010 at 11:34 PM.

Similar Threads

  1. Replies: 5
    Last Post: 04-30-2010, 05:05 PM
  2. need a loop to add new row(s)
    By doha786 in forum New To Java
    Replies: 1
    Last Post: 02-03-2010, 06:21 AM
  3. while-loop stopping on first loop
    By davester in forum New To Java
    Replies: 6
    Last Post: 06-26-2009, 08:46 PM
  4. Strings and delimeters
    By Manfizy in forum New To Java
    Replies: 12
    Last Post: 06-09-2009, 07:51 AM
  5. Loop, is it what I need?
    By dbashby in forum New To Java
    Replies: 4
    Last Post: 04-14-2009, 04:28 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts