Questions tagged [scjp]

SCJP is a certification for programmers experienced using the Java programming language. SCJP affirms that the programmer really knows how to code in Java. However the ability to design and implement a complete application is not affirmed by this test (it is affirmed by the second step certification, SCJD).

SCJP (Sun Certified Java Programmer) is a certification for programmers experienced using the Java programming language. Achieving this certification provides clear evidence that a programmer understands the syntax and structure of the Java programming language and knows enough about J2SE system library.

During the test, the programmer needs to solve multiple short programming tasks in a limited time. Unlike the second level (SCJD) test, the SCJP test does not require to implement and demonstrate a complex working application.

285 questions
0
votes
5 answers

A SCJP Question on topic Enums

From the SCJP Questions PDF book, I got this question.. 1. enum Animals { 2. DOG("woof"), CAT("meow"), FISH("burble"); 3. String sound; 4. Animals(String s) { sound = s; } 5. } 6. class TestEnum { 7. static Animals a; 8. public static void…
user617597
  • 788
  • 3
  • 9
  • 21
0
votes
1 answer

Use of locale-specific grouping separator in java Formatter

I'm studying for SCJP, and my book (Sierra's) says about the Formatter class that I can use the flag "," to use locale-specific grouping separator. If I understand well, this line of code: System.out.printf("%2$,f + %1$,f", 123.7, 456.2); should…
The Student
  • 27,520
  • 68
  • 161
  • 264
0
votes
1 answer

Java SCJP/OCPJP

Given: public class NamedCounter{ private final String name; private int count; public NamedCounter(String name) { this.name = name; } public String getName() { return name; } public void increment() { count++; } public int…
0
votes
2 answers

Unexpected overloaded method compiler selection with null parameter

I am very surprised why output is very much different from what I am expecting , I have two overloaded methods, one having one String and the other an Object as parameter, while calling this method with null parameter, output is just…
Jitendra Prajapati
  • 1,002
  • 1
  • 10
  • 33
0
votes
2 answers

Getting the output with two threads executing

Here is a question from SCJP dump: public class Threads1 { int x=0; public class Runner implements Runnable{ public void run(){ int current=0; for (int i=0; i<4; i++){ current =…
Dengke Liu
  • 131
  • 1
  • 1
  • 10
0
votes
2 answers

Test Killer 310-065 for SCJP (Java)

Given: interface TestA {String toString();} public class Test{ public static void main(String[] args){ System.out.println(new TestA()){ public String toString() {return "test";} } } } In the book, the result of this code is…
Dengke Liu
  • 131
  • 1
  • 1
  • 10
0
votes
2 answers

objects in String constant pool in java

public class NewClass { public String makinStrings() { String s = "Fred"; s = s + "47"; s = s.substring(2, 5); s = s.toUpperCase(); return s.toString(); } } How many objects are created in the above…
user4277706
0
votes
1 answer

Multi threading instance field implementation

public class Chicks { synchronized void yacks(long id) { for(int x = 1; x<3; x++) { System.out.println(id + " "); Thread.yield(); } } } class ChickYacks implements Runnable { Chicks c;…
user4414924
0
votes
2 answers

Hashcode method implementation based on length of the string passed

public class Dog { String name; public Dog(String name) { this.name = name; } public boolean equals(Object o) { if ((this == o) && ((Dog) o).name == name) { return true; } else { …
kittu
  • 6,662
  • 21
  • 91
  • 185
0
votes
2 answers

Sorting of Strings using collections.sort() method

As per the documentation: This implementation dumps the specified list into an array, sorts the array, and iterates over the list resetting each element from the corresponding position in the array Given the program below, I am not able to…
kittu
  • 6,662
  • 21
  • 91
  • 185
0
votes
1 answer

Are interned constants eligible for GC?

Quoting this page: How many objects will be eligible for GC here? String s = "hello"; Character ch1 = 1; Character ch2 = 1; ch1 = null; s = null; I believe the answer is 1. I would like to understand how it works in Java 6. My understanding at…
Adam Stelmaszczyk
  • 19,665
  • 4
  • 70
  • 110
0
votes
2 answers

Java Throw-Catch Exception Confusion -1 with example

I know what are the output. But question is what is the explanation of that out put. public class LongExp{ LongExp() throws Exception{ LongExp.start(); } public static void start()throws RuntimeException{ throw new…
0
votes
1 answer

Serialization With HashCode Method

I have code for Testing Serialization with One Static Member. Here Is the Car Class public class Car implements Serializable { private String number; private String color; private String model; static int y = 23; public…
MRX
  • 1,611
  • 8
  • 33
  • 55
0
votes
1 answer

SCJP 6 issue : classpath and current directory

I am taking up SCJP 6 and came across a question which is as follows. Given: 2. import rt.utils.Remote; 3. public class Controller{ 4. public static void main(String[] args){ 5. Remote remote = new Remote(); 6. } } And rt.utils.Remote class is…
user3201640
  • 571
  • 3
  • 10
  • 19
0
votes
3 answers

Is there any book for upgrade to java se 7 programmer certification exam?

I need help. I want to appear for upgrade to java se 7 programmer certification exam. While searching on net, I found this.. Oracle Tutorial for upgrade to java se 7 certification Is there any book for the same? Thanks
bsm
  • 1,793
  • 11
  • 30
  • 41