Sergio Calvo

Greenhorn
+ Follow
since Feb 22, 2008
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Sergio Calvo

"&&" and "||" guarantee you that they operate on the logic values of your variables, not on their bits representation.

"&" and "|" happen to be also logic operators but they operate on the bits level of your variables, no matter on their logical values.

Since true and false happen to represent bits values in Java, there's no problem in this particular case. But "&" and "|" are used for other kinds of low level bitwise operations (changing many 1's and many 0's here and there) required only in a few applications.
They refer to two very different concepts:

1. the class persistent state refers to the action of save the object (and its members) to a database. Which members should be saved (should be persisted) and which ones not (should not be persisted because they are in effect "transient").

2. the degree of access/visibility the class allows to the rest of the universe (other packages and or classes).
I think this may belong more to Java Beginner/Intermediate than here...

About the first one, static vars are stored in fixed memory locations and prior to object creation. That's why you can use them without instantiating any objects, like with Math.PI. Remember there's one and only one static var shared among all objects, it belongs to the class, no to its instances.

About the second one, I'm not sure.
That's because the way in which arrays work in Java.

The Java compiler always, always needs to know how much space to take for your Array when you are creating it (with "new").

In the first case, int[] arr = new int[];

The compiler doesn't have that data, so it will always, always, fail. It doesn't know how much space do you actually need.

But, in the second case, there's a subtle difference,

int[][] arr = new int[5][];

The compiler actually has the data it needs, it needs 5 spaces for the new array (the first dimension). That's all it needs.

The second dimension doesn't matter at this point since it is another set of different arrays. So the compiler will happily continue with no problems.

But, you will actually need to make that initialization when you try to use it, say for example:


arr[0] = new int [2]; //arr[0] is going to be another array with two ints.

arr[0][0] = 50; //the first int in array[0] is 50;
arr[0][1] = 100; //the second int in array[0] is 100;

Does it makes sense?
13 years ago
Yes you're required to do so. Code will not compile otherwise.

An interface is a basically a contract, any implementing class should stick to the contract.

When interface BB extends interface B it's basically adding more requirements to the original contract in B.

So any class implementing BB must adhere to the new items in the contract, but also to the original ones.
For starters you should take a look to the Mock Tests section of the ranch: http://faq.javaranch.com/java/ScjpMockTests

And it may be a good idea for you also to review the Cert FAQ:
http://faq.javaranch.com/java/ScjpFaq

Reading once is the first step, it is good if you've been there three times. But you should not attempt the exam without doing a serious effort on mock exams or sample exams/questions. It is the only way to assess your real learning process and improve what you need to improve.

It is not about how much have you read, it is more about how much do you understand. And reading alone will not take you there. You need reading + practice + improve. And Mocks are a must for that.