This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Pipeline as Code and have Mohamed Labouardy on-line!
See this thread for details.
Win a copy of Pipeline as Code this week in the Cloud/Virtualization forum!

Eishpal Dhillon

Greenhorn
+ Follow
since Sep 25, 2000
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 Eishpal Dhillon

Yeah I was looking at a number of the other responses with regards to the locking mechanism. I think that the only way to do is to track who has which record locked. If the ArrayList, or Array or whatever you choose to implement is a static object in the Data class, such that the same locking array is accessed by each instance of the Data object. Then you have to keep track of which client has which data record locked.
But thanks for your quick response.
Are we allow to modify the lock(int) and the unlock(int) methods at all. For example I wanted to change lock and unlock to:
void lock(int i, Object o)
void unlock(int i, Object o)
The reason for this is that I was planning on implementing the locking mechanism as a static inner class of the Data object. I also wanted to keep track of who was locking each of the records and the Object o allows me to have each data object when calling lock or unlock use 'this' as a parameter.
Thanks for your help is advance!
I don't know why but for some reason it no longer gives me that error. I haven't changed anything but it seems to be loading fine. I didn't check the Java Console that is a good idea, actually I had no idea that it could be viewed while loading an applet.
Thank You
20 years ago
Why do I get an Applet Notinited Error When Running this Applet. It seems to work when I use AppletViewer but as soon as I use HTML it stops working. What's wrong. I use the HTML Converter to make the HTML file so there shouldn't be any error's with that?

[This message has been edited by Eishpal Dhillon (edited November 08, 2000).]
[This message has been edited by Eishpal Dhillon (edited November 08, 2000).]
20 years ago
The only thing that is affected is the access to the constructor function. Private constructors can only be called within the same class. Meaning that a new object cannot be initialized if it is done outside of the class in which the constructor is declared. However a public constructor can be called from any location. Private constructors are predominantly used when programmers want to put constraints on the creation instantiation of objects.
Hope that helps!
20 years ago
I am a recent graduate from the University of Rochester, as my resume indicates. My degree was not in a technologically based field, however I always had an interest in programming and internet development. After graduation I decided to pursue a Sun Microsystems Java 2 Programmers Certification, which I felt would give me some (although admittedly preliminary) qualifications for a programming job. I passed that exam after 3 weeks of preparation and am studying JDBC, RMI, and Swing among other advanced Java topics as I look for a full time position.
I am particularly looking for positions in the Washington DC area... however I am willing to relocate to other parts of the continental United States if the right opportunity presents itself. Please feel free to e-mail for my resume. And oh yeah I am a US Citizen, so no sponsorship necessary.
20 years ago
Actually this is a question which I have seen come up numerous times on this discussion group and I think a lot of people find it confusing:
Which of the following statements are true?

1) static methods do not have access to the implicit variable called this
2) a static method may not be overriden
3) a static method may not be overriden to be non-static
4) a static method may not be overloaded
Answer to Question 17)
Objective 1.2)
1) static methods do not have access to the implicit variable called this
3) a static may not be overriden to be non-static
The implicit variable this refers to the current instant of a class and thus and by its nature a static method cannot have access to it.
--------------------------------------------
However it is my belief and other people have supported this that in fact #2 is also correct. Although overriding a static method does not result in a compiler error, it does not actually override the base class method. It actually acts to shadow the base class method.
For example here is some test code:
class Inner {
static void hello() {
System.out.println ("Inner");
}
}
public class Test extends Inner {
int a = 0;

static void hello() {
System.out.println("Test");
}

public static void main(String[] args) {
Inner t = new Test();
t.hello();
}
}
Upon running the output is only: Inner
That shows that the base class method has in fact NOT been overridden! Please correct me if I am wrong!
Thank you very much... yeah I did mean Static reference. Thanks for picking up on that typo too! That helps a LOT!
What will happen if you compile/run the following code?
1: class Test
2: {
3: static void show()
4: {
5: System.out.println("Show method in Test class");
6: }
7: }
8:
9: public class Q2 extends Test
10: {
11: static void show()
12: {
13: System.out.println("Show method in Q2 class");
14: }
15: public static void main(String[] args)
16: {
17: Test t = new Test();
18: t.show();
19: Q2 q = new Q2();
20: q.show();
21:
22: t = q;
23: t.show();
24:
25: q = t;
26: q.show();
27: }
28: }
A) prints "Show method in Test class"
"Show method in Q2 class"
"Show method in Q2 class"
"Show method in Q2 class"

B) prints "Show method in Test class"
"Show method in Q2 class"
"Show method in Test class"
"Show method in Test class"
C) prints "Show method in Test class"
"Show method in Q2 class"
"Show method in Test class"
"Show method in Q2 class"

D) Compilation error.
-------------------------------------------
Here is another question on one of the mock exams, which confused me as far as the given answer. The listed answer is that line 25 would require an explicit cast. However I believe that this is incorrect as in line 22 reference t is assigned an object of type Q2. Therefore in line 25 q is pointed to the object t was assigned to which happens to be the Q2 Object. Please inform me as to how accurate my logic is???
In addition this problem brought up an additional question. According to numerous sources which I have seen abstract methods cannot be overridden. Does this mean that the compiler will issue an error when trying to override. Or does it mean that the subclass method will simply shadow the superclass method?
Thanks Again
I have a quick question although Applets and their related HTML code are not listed anywhere on the SUN Objectives for the exam. However, it appears that a lot of the mock exams include questions involving knowledge of this.
So are these questions of the exam or not???
I have a question concerning one of Mock Exam Problems:
What is the result of compiling and executing the following program:
public class Test2{
public static void main(String[] args) {
String message="hello";
new Test2().run(message);
System.out.println(message);
}
public void run(String text) {
text += " world,"
System.out.println(text);
}
A) hello world, hello world
B) hello world, hello
-------------------------------------------------
I thought the solution should be B as the method receives a copy of the original reference. Therefore the text now points to a new object which concats the "world," string. While message reference should point to the original unmodified "hello" string object. However the answer listed is A. Could someone please inform me of where the error in my logic is!