Search:

Type: Posts; User: JavaHater

Page 1 of 2 1 2

Search: Search took 0.18 seconds.

  1. Replies
    4
    Views
    2,600

    Re: Help With Validation

    I suppose you mean "^[0-9]{5}$"
  2. Replies
    8
    Views
    2,164

    Re: Printing name tags from a csv file

    you should remove the post then. If you leave it , you are telling people you don't mind , even though you advocate it.
  3. Replies
    8
    Views
    2,164

    Re: Printing name tags from a csv file

    why StringTokenizer? A simple split will do. Also , StringTokenizer is outdated. The Scanner has useDelimiter() for these things.
  4. Replies
    3
    Views
    1,129

    Re: Problem with arrays

    you can make a count of how many odd integers there are first. After that you can initialize the ans array with that count size. Then go through the array again and store the odd number. Or you can...
  5. Replies
    10
    Views
    1,977

    Re: separate strings

    of course, but note that its only one space, (not white space, which includes tabs etc). If all the "blanks" between the words are tabs, it will not work.
  6. Replies
    10
    Views
    1,977

    Re: separate strings

    you can just use splitting. eg, splitting by whitespace



    String str = "hello world my nane is mike"
    String s[] = str.split("\\s+")


    note, each individual word is stored in a String array....
  7. Re: Missing a line or two of code,b ut dont know what it is.

    remove the for loop but leave the print statement. also, why are you using parseInt() ? remove it.
  8. Re: Missing a line or two of code,b ut dont know what it is.

    I have already told you in another forum, the s array contains all the fields you want. if you want to get the month field, then use s[0]. Similarly the rest. Didn't you learn arrays yet? the for...
  9. Replies
    2
    Views
    1,509

    Re: Error with contains and CharSequence.

    the String class has methods to check for strings and substrings. Strings.contains(), String.matches(), etc....
  10. Replies
    3
    Views
    1,996

    Re: "?" replacement

    "?" is special to regular expression. try escaping it. "\\?"
  11. Replies
    2
    Views
    1,242

    [SOLVED] Re: replacing elements in a string

    try


    pdphrase = pdphrase.replaceAll("a", "00");
  12. Replies
    4
    Views
    4,679

    Re: How to extract text from web

    well, once you can work with getting the text from 1 url, you can parse the text, search for further links, and then do a url connection to get contents from those links found. you have to do some...
  13. Replies
    4
    Views
    4,679

    Re: How to extract text from web

    you can see an example here
  14. Replies
    15
    Views
    3,058

    Re: renaming/deleting file

    how did you define dir variable? try also to remove the "static" keyword.
  15. Replies
    6
    Views
    1,550

    Re: This program works but Want to improve

    the requirement should have digits and letters ( as in OP's post). what if the result of randomly choosing from all letters(upper+lower) and numbers ended up in all letters? (or all digits? ).
  16. Replies
    6
    Views
    1,550

    Re: This program works but Want to improve

    i would rather use Scanner class for your input. Also, you could probably do a shuffle() method (or use the shuffle() method from Collections class) so that your numbers and letters are jumbled up...
  17. Replies
    2
    Views
    2,319

    Re: Spoonfeeding.

    I have already replied to you in that thread, so am not going to repeat here.
  18. Replies
    23
    Views
    2,833

    Re: looping and arrays

    it takes 2 hands to clap remember?


    don't take it seriously


    Its 50 - 50. Giving examples for them to have a start is also all right. So there is no reason for you to stop. Even if you do...
  19. Replies
    23
    Views
    2,833

    Re: looping and arrays

    the requirement also said nothing about anything else. Its left for us to interpret. You are a super genius to only stop at one level. However, I went a bit far ahead to suggest he keeps a score of...
  20. Re: How to define a string pattern using variables?

    Sometimes regex is not the right tool for the job. Where does you strings come from ? a text file?
  21. Replies
    2
    Views
    8,643

    Re: Writing to a specific line in a text file

    here's an example


    public class ReadWriteFile {
    public static void main(String[] args) throws FileNotFoundException, IOException{
    Formatter output = new Formatter(args[1]);
    ...
  22. Replies
    8
    Views
    1,342

    Re: I can''t understand this error

    you declared quiz to be 9 elements


    SimpleQuestion[] quiz = new SimpleQuestion[9];

    but you only have 3 quizzes that have values. That's why you have the error. either initialize your quiz...
  23. Re: How to get a System's total CPU usage percentage using a java program

    you can also try WMI using Java.

    you can see an example of how its done using vbscript. Then adapt the WMI code portion with Java.
  24. Replies
    7
    Views
    2,317

    Re: Needed help in actionPerformed statements

    what exactly did you don't get? I provided examples of where you can put your handlers in your code.
  25. Replies
    2
    Views
    2,263

    [SOLVED] Re: If statement problems

    here's an example for you


    if ( myVariable >= 20 && myVariable <=30 ){
    System.out.println("you failed" );
    }else if ( .......... ){
    ...........
    }
Results 1 to 25 of 46
Page 1 of 2 1 2