scjp Questions
3
Solved
How many String object are created
I am studying for the SCJP I cant seem to get my head round this String problem. I seem to see several possible answers depending on how i look at a question.
...
3
Solved
The Context:
It appears that the simple scjp ->scja->.... tracks for sun certification have been merged with other oracle style certifications... As a developer, I've spent some time lately tryin...
5
Solved
In code snippet below, declaring the doThings() method as static would make the class thread-safe. Is the reason for this that if multiple TestSeven threads are started and since x is a static vari...
2
Solved
I'm studying up for the SCJP exam, upon doing some mock tests I came across this one :
It asks what is the output of the following :
class TestClass
{
int i = getInt();
int k = 20;
public int ...
3
Solved
In one example from http://leepoint.net/notes-java/data/expressions/precedence.html
The following expression
1 + 2 - 3 * 4 / 5
Is evaluated as
1 + 2 - 3 * 4 / 5
= (1 + 2) - ((3 * 4) / 5)
=...
3
Solved
As you may know, some people are declaring singletons with an Enum of 1 instance, because the JVM guarantees that there will always be a single instance with no concurrency problems to handle...
T...
Mushy asked 29/9, 2011 at 15:34
3
Solved
I have the following Java code:
public String makinStrings() {
String s = "Fred";
s = s + "47";
s = s.substring(2, 5);
s = s.toUpperCase();
return s.toString();
}
The question is somehow si...
2
Solved
I'm currently preparing the S(O)CJP, with the Sierra & Bates book.
About inner classes (method local or anonymous), they say that we can't access the local variables because they live on the s...
Googolplex asked 16/8, 2011 at 10:28
3
Solved
When overloading methods that contain parameters that dont match, the JVM will always use the method with the smallest argument that is wider than the parameter.
I have confirmed the above with t...
Chaos asked 14/8, 2011 at 12:54
2
Solved
While exploring for scjp questions, I came across this behaviour which I found strange.
I have declared two classes Item and Bolt as follows:
class Item {
int cost = 20;
public int getCost() {...
Pl asked 2/8, 2011 at 7:2
3
Solved
Can someone please explain the difference between these two examples in the context of object locking:
public void method1(){
synchronized(this){
....
}
}
And
StringBuffer aStringBufferObje...
Foxy asked 24/7, 2011 at 14:17
4
Solved
I thought that i have some good understanding of Java generics.
This code DOES NOT COMPILE and I know why.
We can pass to test method only List of type Animal or its super type (like List of Obj...
8
Ok I know this might sound a bit silly, as it depends on the person, but on average how much time should I spend on preparing for SCJP? I already have some experience with Java (a few small a...
4
Solved
While preparing for the SCJP-6 exam I faced with a difficult issue. I can’t find answer by myself. Please, answer for the question and give short comments:
abstract class A<K extends Number>...
3
Solved
I would like to know the reason why this is first allowed in Java (or oops in general)
I remember that the static methods are common for both parent and child class
public class Redefine extends ...
Civility asked 15/7, 2010 at 12:25
6
Solved
From MasterExam:
Which statements are true? (Choose all
that apply)
A. is-a relationship always rely on
inheritance
B. is-a relationship always rely on
instance variables
C. is-a relatio...
Araiza asked 13/7, 2010 at 13:38
4
Solved
class Another {
public void method(Object o) {
System.out.println("This is in method which takes object");
}
public void method(String s) {
System.out.println("This is method which takes strin...
Begay asked 14/6, 2010 at 12:48
5
Solved
I know that we cant use assignment operator in if statements in java as we use in any other few languages.
that is
int a;
if(a = 1) { }
will give a compilation error.
but the following co...
Upanddown asked 6/3, 2010 at 20:18
1
Solved
Why does the following program throw an exception?
public class MainClass{
public static void main(String[] argv){
callMethod(2);
}
public static void callMethod(Integer... i){
System.out.pri...
Porscheporsena asked 23/2, 2010 at 21:18
2
Solved
I'm having trouble understanding this question, and the explanation of the answer for an SCJP 1.6 self test question. Here is the problem:
class A { }
class B extends A { }
public class ComingThru...
Phonologist asked 15/7, 2009 at 3:40
© 2022 - 2024 — McMap. All rights reserved.