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

    Default help plz with delimiter 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
    i posted on new to java but many views no reply so thought this is lil advance
    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

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Blog Entries
    Rep Power


    Please don't post the same question in more than one forum. I'm locking this thread as your question is a basic one and belongs in the new to java forum. A couple of suggestions:

    1) Please be patient. We are volunteers not paid, and most will try to answer your question when they have the time.
    2) Your indentation is terrible making it very difficult to read and understand your code, and you'll be likely to have more folks willing to read your code if you format it properly. Frankly this is the reason I personally didn't attempt to answer your question -- I couldn't read your code.


Similar Threads

  1. How to use delimiter in java
    By adityasirohi in forum New To Java
    Replies: 1
    Last Post: 02-12-2010, 11:01 PM
  2. How do you Use Backslash as a Delimiter?
    By Mobius-1 in forum New To Java
    Replies: 3
    Last Post: 12-14-2009, 01:39 AM
  3. Delimiter question
    By Kangaroo128 in forum New To Java
    Replies: 10
    Last Post: 09-09-2009, 10:28 AM
  4. using Delimiter with metacharacters
    By wntdaliv in forum New To Java
    Replies: 10
    Last Post: 12-02-2008, 07:42 AM
  5. delimiter
    By satin in forum New To Java
    Replies: 2
    Last Post: 11-17-2008, 11:50 PM

Posting Permissions

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