I suppose you mean "^[0-9]{5}$"
Type: Posts; User: JavaHater
I suppose you mean "^[0-9]{5}$"
you should remove the post then. If you leave it , you are telling people you don't mind , even though you advocate it.
why StringTokenizer? A simple split will do. Also , StringTokenizer is outdated. The Scanner has useDelimiter() for these things.
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...
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.
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....
remove the for loop but leave the print statement. also, why are you using parseInt() ? remove it.
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...
the String class has methods to check for strings and substrings. Strings.contains(), String.matches(), etc....
"?" is special to regular expression. try escaping it. "\\?"
try
pdphrase = pdphrase.replaceAll("a", "00");
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...
you can see an example here
how did you define dir variable? try also to remove the "static" keyword.
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? ).
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...
I have already replied to you in that thread, so am not going to repeat here.
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...
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...
Sometimes regex is not the right tool for the job. Where does you strings come from ? 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]);
...
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...
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.
what exactly did you don't get? I provided examples of where you can put your handlers in your code.
here's an example for you
if ( myVariable >= 20 && myVariable <=30 ){
System.out.println("you failed" );
}else if ( .......... ){
...........
}