Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!

mohammad jordan

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

Recent posts by mohammad jordan

thank 4 all ,, my Score: 78%
7 years ago
ok sry .. any way Let me try to explain this with an example...

Consider the following text:

Now, if I apply the regex below over it...

... I would get the following result:

But I don't care about the protocol -- I just want the host and path of the URL. So, I change the regex to include the non-capturing group (?.

Now, my result looks like this:

See !! ? The first group has not been captured. The parser uses it to match the text, but ignores it later, in the final result.

example and explain :

the Pattern (a.a) Looking for any tokens Consists of three characters but must start with (a) and end of (a) Regardless of what the middle maybe different character , space ,symbol don't care what in between it
so when run this code the result shoud be

So here Group refer to which part of Matcher i meaning (abaaba) : Applies condition Regular Expressions(a.a) and founded .
because the long 64 bit ant int 32 bit , when you assign any long variable to any primitive less than long must explicit cast .
the value 90 it OK !!that in the int range, but compiler don't know about this.

try this.

is legal and double Greater than long so not compilation error here it implicit casting like this

note : when using this illegal code

advance note : Imagine compiler allowed and success compilation time in run time Exception (Class Cast Exception).but java Shifting this Error from run time to compile time Error.

unreachable statement. because the instance variable (l) marked final so you can not reassign new value OK !!
in while statement the expression (l<10) is false and never change it to true so the cod inner while does not execute never .
but if you initialization any number less than (10) the code will be execute .
i dont understand your question exactly but in General the Assertion just for testing in another word logical Error
dont using assert in your code as do stuff like if statement.
3 & 4 . not Correct because Thread.sleep(500) for the main thread not for two instance thread , so in this case the Thread.sleep(500) don't effect the result still not guaranteed ,

solve 1: if you put (thread.join()) before #1 the result Guaranteed which meaning (11,11) because the first thread will excited and print (11) and the second print statement will print (11) then go to second thread after finishing first thread so the (1&6) are true .
solve 2: if you put(Thread.sleep(500)) in the first anonymous inner class or in Second anonymous inner class still result not guaranteed which meaning(5&6) are true ... Good luck

Remembe r : the Sleep method is static so if you but (Thread.sleep()) in main method this meaning the current thread will sleep in another word the main thread will sleep (500) not other . so not effect in the result
when you implemented any interface must declare the instance methods public but without Access modifier by default the access modifier without any access modifier is defualt
I'll give the exam next week and I want help >> i need Mock Exams plzz
please help me . in (#2) im Assinged to Object (ChicksYack c) but when invoced (c.yack) in line (#3) method in run() method Runtime Exception ? why ?