Vivek Talyan

Greenhorn
+ Follow
since Sep 03, 2002
Merit badge: grant badges
For More
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 Vivek Talyan

GOOD SHOW Aarti.

Is it possible for you to give us some tips on preparing for the SCJP exam? Did you study the Java Language Specification to get such a good score?

Any help would be greatly appreciated.

Thanks
19 years ago
We have not had any bugs reported in methods like these.
My concern is that the 'find()' method could grow in complexity as we add new StatusStates. Also, the logic to find a StatusState can be more complicated than this example.
20 years ago
class A {
boolean calculateValue() {return true;}
}
class B extends A {
boolean calculateValue(0 {return false;}
}
Is it important to test methods like these?
20 years ago
Andy and Dave,
Can you please give me your views on testing static methods like the following -
static LeaseStatusState find(LeaseEntity lease) {
LeaseStatusState statusState = null;
if (isPendingState(lease.getStatus())) {
statusState = LeasePendingStatusState.create(lease);
}
else if (isApprovedState(lease.getStatus())) {
statusState = LeaseApprovedStatusState.create(lease);
}
else {
Assert.isTrue("Lease Status is valid", false);
}
return statusState;
}
In this case it is not possible to mock out the LeasePendingStatusState.create() method as they themselves are static methods.
Should static methods be avoided because it not possible to mock them out?
thanks,
Vivek
20 years ago
Hello all,
I have a web application in which the client changes something and submits it for a save. After saving the information, I need to kick off a time consuming process.
Is it possible to make an asynchronous call to kick off the second process?
Can I do this without using JMS?
thanks,
Vivek
20 years ago
Enter me in the drawing too.
None of the subjects you mentioned are part of the programmer certification exam.
Vivek
Hi Darren,
taking the SCJP exam is quite simple. You do not need a calculator and probably will not be allowed one in the test center. I took the exam a month ago and they did not allow me to take my own pen and paper. I was given a plastic sheet and a marker pen and they took them back after the exam.
Before the exam starts you get an opportunity to play with the software and understand what all the buttons and checkboxes mean. I would highly recommend taking the software for a test spin.
At the end of the test, when you click the submit button, the program shows you your test score and also prints it for you.
Also, the test is not very long and if you can't solve a problem you can mark it for later review and come back to it after you have attempted the last question of the exam.
Vivek
Hi Linda,
what mughal is saying that you can not nest comments like this -
/* some comment 1
/* 2
nested comment 3
*/ 4
*/ 5
The problem is that the comment started on line 1 is being closed at line 4 and not line 5. Once a comment starts, anything that comes before the closing '*/' is not parsed by the compiler. Therefore, the '/*' on line 2 is not starting a new comment. It is just part of the comment on line 1. Also, once the compiler finds a '*/' the comment is supposed to have ended.
Vivek
'0101' is an Octal value i.e. it's base is 8; just as the base of a decimal value is 10 and the base for a binary value is 2.
The decimal value for an octal number can be calculated in the same way that you calculate the decimal value of a binary number.
In this case -
0101 = (0*8^3) + (1*8^2) + (0*8^1) + (1*8^0)
= 0 + 64 + 0 + 1
= 65
The call at line 7 is a3[2][1][0]. This returns the object of class A that was created earlier. Since this object is being used in a context where a it is being treated as a string (i.e. it is being passed as a parameter to the println() method), the compiler inserts a call to the toString() method of the object.
This results in "A" being printed.
Hope this makes sense.

Originally posted by Michael Taupitz:
In Dans Mock-Exam about GC (Study Guide Chapter 8, Mock 1) is a problem about the correct answer.

Which of the following are true statements and which of the following could be a result of attempting to compile and run the program?
a. Prints: XY
b. Prints: YX
c. Prints: XXYY
d. Prints: YYXX
e. Nothing is printed.
f. There is no guarantee that the garbage collector will run.
g. Compiler Error.
h. Run Time Error.
i. None of the above.
-------------------------------------
Dan says answers a,b,e,f .
But, if answer f is correct (and i would say, thats the only correct answer) all other answers are incorrect - or ?
Michael


The question asks you what 'could' happen. So, if the garbage collection runs and the objects of class B are garbage collected, 'a' and 'b' might happen. Otherwise, if the gc does not run (which is what 'f' says) then nothing will be printed.
Thanks to all Java ranchers for helping me pass the certification exam.
In particular Alfred Kemety, Valentin Crettaz, and Dan Chisholm.
The exam itself is consistent in style and difficulty to Marcus Green's exams.
One thing I did notice was that a lot of the questions involving coding had compilation errors or runtime errors. It is better to check for errors in the code before going through and trying to get the correct result.
Next, I would like to go for the SCWCD certification. Can I please get some guidance on how to go about it.
thanks,
Vivek
21 years ago