exam questions

Exam 1z0-819 All Questions

View all questions & answers for the 1z0-819 exam

Exam 1z0-819 topic 1 question 9 discussion

Actual exam question from Oracle's 1z0-819
Question #: 9
Topic #: 1
[All 1z0-819 Questions]

Given:

and

What is the result?

  • A. Joe -
    null
  • B. null
    Mary
  • C. Joe -
    Marry
  • D. null
    null
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
JGR_77
Highly Voted 1 year, 4 months ago
b: public static void main(String[] args) { String s = "joe"; System.out.println(checkPerson(s)); s= null; System.out.println(checkPerson(s)); } public static String checkPerson(String s) { if(s==null) { s= "mary"; }else {s= null;} return s; } null mary
upvoted 5 times
...
d7bb0b2
Most Recent 6 months, 4 weeks ago
Selected Answer: A
A is correct, check person never modified value for p so take the values from main method
upvoted 1 times
...
duydn
8 months, 4 weeks ago
Selected Answer: A
class Person{ private String name; public Person(String name) { this.name = name; } public String toString() { return name; } } class Test { public static void main(String[] args) throws IOException { Person p = new Person("Joe"); checkPerson(p); System.out.println(p); p=null; checkPerson(p); System.out.println(p); } public static Person checkPerson(Person p) { if (p == null) { p = new Person("Mary"); } else { p = null; } return p; } } -> A
upvoted 2 times
...
[Removed]
10 months, 2 weeks ago
It's A. If it would have been p = checkPerson(p); Then correct answer would have been answer Null and then Mary. Now it's just checkPerson(p) so p remains "Joe" and then Null.
upvoted 3 times
...
great_chainick
10 months, 2 weeks ago
Selected Answer: B
1th checkperson transforms joe to null , so system.out.print print null 2th checkperson recieve null and transforms this null to mary , so system.out.print print in the console "mary"
upvoted 2 times
...
Javi_sc
11 months, 4 weeks ago
Selected Answer: A
A is correct
upvoted 1 times
...
Stavok
1 year ago
Selected Answer: A
A is CORRECT
upvoted 1 times
...
aruni_mishra
1 year, 1 month ago
Selected Answer: B
B. Correct
upvoted 1 times
...
Mukes877
1 year, 2 months ago
Selected Answer: A
A is correct because Changes in references of Person p are in the Person class so that object has different scope So There will be no effect on the Tester class object.
upvoted 2 times
...
AlanRM
1 year, 3 months ago
Selected Answer: A
is correct A
upvoted 1 times
...
Ankit1010
1 year, 6 months ago
A is the correct Answer
upvoted 4 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago