• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SCJP 5 Questions

 
Sundeep Gupta
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have few unsolved questions. Could anyone please provide me with answers. I'm writing the exam within 2 days. Plz reply ASAP.

Here goes the list.............

Question 1 :

Encapsulation involve separating the interface of class from implementation. Yes or No.

Question 2 :

wait() and notify() methods are defined in Thread class ? Yes or No?

I knew that they are in Object class but Thread itself extends Object so they are available in Thread class too.
What should be my answer Yes or No?

Question 3:
following regular expression will match non digit character "\D". True or False ?

I'm confused coz, "\D" is evaluated as non-available escape sequence (Error) whereas "\\D" is correct. If so answer is False.

Correct me if i'm wrong.


Thanks
Sundeep
 
Mikalai Zaikin
Ranch Hand
Posts: 3332
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Sundeep Gupta:


Question 2 :

wait() and notify() methods are defined in Thread class ? Yes or No?

I knew that they are in Object class but Thread itself extends Object so they are available in Thread class too.
What should be my answer Yes or No?



Answer: No

Object class defines those methods
Thread class inherits those methods

regards,
MZ
 
Sundeep Gupta
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But in one of the mock exam (A.K Gupta's exam)it is stated that they are in Thread class. The problem was like this :

Which of the methods are defined in Thread class :

a. wait()
b. notify()
c. terminate()
d. yield()
e. sleep()

and answer was a, b, d, and e. Is this correct or d,e is the correct answer ?

Thanks
Sundeep
 
Marcus Green
arch rival
Rancher
Posts: 2813
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I recommend taking a look at the official documentation to get a definitive answer to this question. Try the following links.

http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Thread.html
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic