Questions tagged [ocpjp]

OCPJP (Oracle Certified Professional, Java Programmer), formerly Sun Certified Java Programmer (SCJP), is a certification for programmers experienced using the Java programming language. Achieving this certification provides clear evidence that a programmer understands the basic syntax and structure of the Java programming language.

http://education.oracle.com/pls/web_prod-plq-dad/db_pages.getpage?page_id=320&p_org_id=28&lang=US

80 questions
1
vote
1 answer

SCJP/OCPJP 7 objectives

Which are the new objectives added for SCJP/OCPJP 7? Or to be more specific what are the changes between SCJP/OCPJP 6 and 7? PS: I am not sure if it is still called as SCJP. EDIT : I have added a post for new changes / objectives added to…
Ajinkya
  • 22,324
  • 33
  • 110
  • 161
1
vote
3 answers

Java generics - Supertype references

If i have understood generics correctly, a method with parameters declared as will accept any reference that is either of Type T or a super type of T. I am trying to test this with the following bit of code but the compiler does not like…
ziggy
  • 15,677
  • 67
  • 194
  • 287
1
vote
2 answers

Garbage collection mock for the OCPJP exam

Four objects are eligible for garbage collection when i3 = null; is executed in the class shown below. I've added comments to explain how I got this answer. Is my reasoning correct? public class Icelandic extends Horse{ public void makeNoise(){ …
blue-sky
  • 51,962
  • 152
  • 427
  • 752
1
vote
5 answers

Java Thread object vs Running Thread

Hi i am studying and playing with thread in java. i read in a book that Thread object and Running Thread is not same thing.even the thread complete it's run method running thread goes into dead state i even check that with isAlive() method. i want…
T.Malik
  • 107
  • 1
  • 10
1
vote
2 answers

Oracle certification (OCA JP-1z0 803 and OCPJP- 1z0 804)

As I know, to become an Oracle Certified Professional Java SE 7 Programmer, have to pass both OCAJP and OCPJP exams. And it is possible to do in any order (ex – OCAJP --> OCPJP or OCPJP --> OCAJP). Yesterday I was able to pass OCPJP exam and I am…
user2486322
  • 847
  • 3
  • 13
  • 31
1
vote
1 answer

Java Path interface and OCPJP7 Exam

I’m preparing for OCPJP7 exam on these days. I got two questions and accepting answers. First one is relevant to java and other one is about exam achievements. import java.nio.file.*; class Test13{ public static void main(String arfd[]){ …
user2486322
  • 847
  • 3
  • 13
  • 31
1
vote
2 answers

Assertion Error issue

I have posted this elsewhere, no solution yet, so posting it here as well. The below mentioned code is not throwing an assertion error as I expected it to since num is less than 5. Hope someone can advise. Thank you. public class Wrong { public…
John Java
  • 153
  • 1
  • 3
  • 8
1
vote
2 answers

Can somebody explain how does this program regarding enum works in java?

Here's the code : enum Status { STATUS_OPEN(10), STATUS_STARTED(11), STATUS_INPROGRESS(12); private final int status; Status(int aStatus) { this.status = aStatus; } public int getStatus() { return…
Ajinkya
  • 147
  • 1
  • 2
  • 11
1
vote
3 answers

Inquiry about cohesion in java programming

How would you define the following code? a) High cohesion b) Low cohesion I would say High as even though takeAndGlue() does 2 things they are called with 2 separate methods, hence the stackTrace is traceable. public class Assembler() { …
Rollerball
  • 12,618
  • 23
  • 92
  • 161
1
vote
1 answer

ResourceBundle fully qualified name with extensions

From this book "Oracle Certified Professional Java SE 7 Programmer Exams 1Z0-804 and 1Z0-805: A Comprehensive OCPJP 7" A fully qualified resource bundle has the following form: packagequalifier.bundlename + "" + language + "" + country + "" + …
Rollerball
  • 12,618
  • 23
  • 92
  • 161
1
vote
1 answer

Why can not I use toString().length() as a hashCode() return?

public class Dog { int collarID; String name; public static void main(String[] args){ Dog d = new Dog(); d.name="hose"; System.out.print(d.hashCode()); } public boolean equals(Object arg0) …
Joe
  • 7,749
  • 19
  • 60
  • 110
0
votes
2 answers

Need an explanation for the output

Why are "Hi1" and "Hi3" displayed twice by the following code? static int a=1; public static void main(String[] args) { if (a==2) { System.out.println(args[0]); a = 3;} if (a==1) { main(); } …
Manav Bhanot
  • 113
  • 3
  • 16
0
votes
1 answer

Thread concurrency - synchronisation and locks.

import java.util.*; import java.io.*; import java.util.regex.*; class ZiggyTest2 extends Thread{ String sa; public ZiggyTest2(String sa){ this.sa = sa; } public void run(){ synchronized(sa){ …
ziggy
  • 15,677
  • 67
  • 194
  • 287
0
votes
3 answers

Java - ArrayList removal of duplicate items

In the following example: public static void main(String[] args){ List list = new ArrayList(); list.add("hi"); list.add("hi"); list.add("hi"); list.remove("hi"); …
ziggy
  • 15,677
  • 67
  • 194
  • 287
0
votes
1 answer

OCPJP 6.0 upgrade

I got the OCPJP 6.0 certification 6 years back or so. I am planning to upgrade it to one of the latest Oracle certifications. Could you please recommend if I should appear for the upgrade to OCPJP 8.0/11.0 exams? Also if there is another…
Hello
  • 143
  • 4
  • 12