This week's book giveaway is in the Reactive Progamming forum.
We're giving away four copies of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams and have Adam Davis on-line!
See this thread for details.
Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!

Hasan Fatih

Greenhorn
+ Follow
since Sep 06, 2014
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Hasan Fatih

Yes, I am using Netbeans. Why did you ask me this question?
4 years ago
I was just trying to enter input into the file. Then I was expecting to close file and BUILDING SUCCESSFULL notification in the output with CTRL+D. Because with CTRL+D, the program should exit from the while loop in the addRecords(), so the addRecords method should have finished, and finally the closeFile method should have been executed. Thereby the program should have finished properly. But the program doesn't finish. Just go ahead in the while loop. Why?

As far as I understand from my book that the loop terminates with CTRL + Z combination in windows and CTRL + D combination in linux/unix/mac os x.
4 years ago
Hi,
I've learned from my book that the end of file indicator for linux systems is CTRL + D. But when I tried to CTRL + D combination, then enter, the program didn't stop. It still continued. How can I handle this problem? I'm using Netbeans on Ubuntu. Here are the codes:





4 years ago
Now the information, which you shared, placed to my mind clearly. Thank you so much.
4 years ago

Henry Wong wrote:
And by any number, zero is possible right?


Yes exactly.

Henry Wong wrote:
For "Doe", it matches [a-zA-Z] three times, and hence, match the "[a-zA-Z]+" component.As for the rest of "Doe", which is nothing, it matches "([ '-][a-zA-Z]+)*" zero times, doesn't it? In fact, it doesn't matter what the pattern is, in the group, there is nothing left to match, and hence, it will match it zero times.


Interesting. I knew that [a-zA-z] corresponds to just one character, and + corresponds to any character by any number except empty. But as far as I understand you, + means some characters which are [a-zA-Z]. I understand like that, because you said "it matches [a-zA-Z] three times". So according to this light, I can say that ([ '-][a-zA-Z]+)* means the characters, which are [ '-][a-zA-Z]+, by any numbers or just empty. Do I understand you wrongly?

But for this idea, there is a problem for the following code. For regExp expression "\\d+", \d means a number as just one character and then + means again number(s) by any number. But I know that + accepts at least one character. It doesn't accept empty. But in the following code, while zipCode is "1", the output is "Valid zip code". Whereas "1" corresponds to \d, but +? For +, there is no number. So the program should have outputed "Invalid zip code". But it is not...



-------Edit:

Henry Wong wrote:
And by the way, unfortunately, you are wrong. An asterisk is not a character in any number. An asterisk qualifier is zero or more of the previous -- this means that this ... "([ '-][a-zA-Z]+)*" pattern is zero or more of this group pattern "[ '-][a-zA-Z]+". And of course, zero of that group matches a zero length string.


I saw your last post after I had written my response. That is, I understand this concept about asterisk. But I don't understand the code above as I mentioned.
4 years ago
I know that the asterisk qualifier means character(s) in any number.(Is this wrong?) So for "Mc-Something", 'M' corresponds to [a-zA-Z], 'c' corresponds to +, - corresponds to [ '-], 'S' corresponds to [a-zA-Z], "o" corresponds to +, and finally "mething" corresponds to *, doesn't they? But for "Doe", there is no any space, apostroph or hypen.
4 years ago
Hi,
I have some problems about performing regular expression. In the following code, the output as a result is being "valid last name". But in my opinion, it should be "invalid last name". Because "Doe" has not any space, apostroph or any hypen. Look at the regular expression statement: "[a-zA-Z]+([ '-][a-zA-Z]+)*" So could anyone explain this situtation? In where am I wrong? What is my fault in this idea?



4 years ago

Rob Spoor wrote:Because non-local variables (static fields or instance fields) actually do get instantiated; if no explicit value is given they will be given a default value (false for booleans, 0 for numbers, '\0' for chars, null for objects).



I was supposing that once a new object was created(instantiated) from a class, the fields of object initialized to default value automatically. Although I don't create an object of the class, the fields are initialized to default value as you said. That's interesting. Thank you for your advice and explanation.
5 years ago

Maneesh Godbole wrote:To add (more confusion )
Now edit your code to declare it as an instance variable instead.

Now what do you observe?



Oppss.. The problem has gone with that way. No problem anymore. But why? I am confused.
5 years ago
Hm... Okay. Thanks for your explanation.
5 years ago

Jeanne Boyarsky wrote:We can say the compiler isn't looking for matching conditionals. As for whether it is smart enough, that is a human judgement call.



Okay, thanks guys for your replies.
5 years ago