Win a copy of Terraform in Action this week in the Cloud forum!

Ivan Rebrov

Ranch Hand
+ Follow
since Jul 09, 2006
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 Ivan Rebrov

Certification Manager - where can I find the logo?

I've passed exam and want to find a logo of SCJP or a logo of SUN certification programm.

Where could it be?

P.S. Please don't tell me, that this logo is quite enough:


[ October 11, 2006: Message edited by: Ivan Rebrov ]
SCJP 5.0 - 95%

Passed exam yesterday.

My learning experience:

1. Java development - 1 year
2. SCJP Sun Certified Programmer for Java 5 Study Guide (Exam 310-055) - 3 months
3. Javaranch - 3 months
4. http://www.examulator.com/phezam/question.php - 1 month

It took me 131 minutes to solve all questions, and 20 minutes to check that everything was right.

It was a real fun to take this exam, thanks to authors!

All drug-and-drop questions are marked as "Application quistion" in final review table. So you don't have to memorize the numbers of this questions. As I tried to review the answers of such questions I recieved each time a confirmation window like "your previos answer will be reset, yes or no?". So don't be afraid to lose your answers without confirmation.
[ October 11, 2006: Message edited by: Ivan Rebrov ]
15 years ago
Check this code to see the difference:



the output is:

I'm static method of Parent
I'm instance method of Child

Originally posted by Simeon Cherniy:
Of cource, we can't be sure of completion of finally block . But the finally block will be executing until it is not finished. If finally block throw exception than on the top of stack trace we will have this exception



Simeon, check this code:



The output is "was thrown in finally" and nothing more.

So, the author of this topic is absolutely right, the answer should be "D"

Originally posted by Matt Caripto:
Hi all,
bringing the total closer to GBP �175, or roughly US$335. I'm also a



The price in Germany is 210 Euro plus tax of 16% - that is 243 Euro, or routhly US$314 !

So, you are not alone!
Unbelievable!!!

Compiles fine:



Doesn't compile: (!!!)




Doesn't compile: (!!!)



Why???

Originally posted by Aniket Patil:
Removing the private modifier for print method in class A and compiling it again does not thrown any compile-time error. The program works fine.




Ooops sorry, it was a bad idea. Now the things are even more complicated;
You can run this method, because this "A.print" has default access, and our B is in the same package.

So please do the following:

1. move your A class to different package,
2. add "public" access modifier to contructor of A.
3. add "protected" access modifier to "A.print",
4. add "public" access modifier "B.print",

Then you will find out, that this problem has nothing to do with overriding.






[ August 16, 2006: Message edited by: Ivan Rebrov ]
[ August 16, 2006: Message edited by: Ivan Rebrov ]

Originally posted by Aniket Patil:
According to JLS, it is possible for a method to have a declared return type and yet contain no return statements.

Example:
class DizzyDean {
int pitch() { throw new RuntimeException("90 mph?!"); }
}

Why does this not work?

class ConstantAccess
{
int method()
{
System.out.println("Inside method()");

}

}



I think that's a wrong point of view. It is better do say so:

If method has a declared return type it must contain return statement.

BUT (!) there are some exceptions: for example, if the code after some statement becomes unreachable (for. ex. after not checked "throw" ).

And this exception is absolutely logical, if you insert "return" statement after "throw" in your example compiler should tell you "Unreachable code".
[ August 16, 2006: Message edited by: Ivan Rebrov ]

Originally posted by Aniket Patil:



You are right in general, but in this concrete case that's not the point.
Remove "private" access modifier of method "print" of class A and you will get the same compiler error.

Originally posted by Firman Drage:
xxxis and instance of class B - and class B has also a method called print...



For compiler xxx is variable of class A. And nothing more.

The information, that this variable actually holds a reference to B instanse will be available only at runtime. And it will be available for VM, not for COMPILER.

Originally posted by Amitabha Batranab:
So are you going to tell us why?



See this table of operator precedence in Java

http://java.sun.com/docs/books/tutorial/java/nutsandbolts/operators.html

operator "==" has lower precedence then �perator "+"

Originally posted by Suhas Wadadekar:
i think both options in bold are valid...but there is no mention of it in the book



You are absolutely right!
[ August 12, 2006: Message edited by: Ivan Rebrov ]

Originally posted by Amitabha Batranab:
ArrayList<Rectangle> c=(ArrayList<Rectangle> b;

here we are assigning an unsafe list to a safe list but we are typecasting it to a safe list first.



This warning message belongs to this part of line:

(ArrayList<Rectangle> b

NOT to this part:

c=(ArrayList<Rectangle>
You should create multiple files. Each public class in it's own separate file.
[ August 12, 2006: Message edited by: Ivan Rebrov ]