Samwise Gamedee

Greenhorn
+ Follow
since Jul 22, 2010
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 Samwise Gamedee

Thanks Ove, Some good examples to support your theory.
9 years ago
Doubts posted below code snippet:

class A {}
class B extends A{}

public class MyClass
{
public static void main(String args[]){
A a = new A();
B b = new B();

a = b ; // 1.... typical upcasting
b =(B)a; // 2.. typical downcasting

a = new A(); //3...assigning new reference of Type A
b =(B)a; // 4...compiles but throws CCE at runtime
}

}

i> Here at 1 we assign reference of type B to a reference of Type A. Hence the Type A object reference (a) now points to an address which contains an object of type B. At 2 we are going reverse. Now, after executing step 1 why does the compiler require an explicit cast at 2 ?

ii> At 3 we are creating a new instance of A and assigning it to a B type reference at 4. While the compiler doesn't complain at 4 but the runtime throws up a ClassCastExcp. How can the compiler allow something which the runtime flatly rejects?

iii> Why should I use downcasting in any scenario since in the end game I am only getting a reference to a Type B object(same or different) using a Type B object? Since through inheritence I am already accessing all the members of my superclass I donot need to use downcasting at all. Please highlight any scenario where we cannot do w/o downcasting at all.


Thanks in Advance for sharing your valuable time. I have made the doubts as legible and intelligible as possible.
9 years ago
I am facing a very strange problem. I have created a project in RAD importing an EAR from WSAD. Basically it was part of a migration project from WSAD to RAD as the dev-tool. This was working fine untill I realised that all my class changes are not reflected because RAD is referring to an "Imported classes" folder which have assorted sets of pre-compiles .class files. Now I realise this can be circumvented easily by compiling the code in a seperate compiler and then deploying the compiled .class file onto RAD but again that's as stupid a solution one can get to. I need to know how do I change my compilation strategy to realtime in RAD?

9 years ago
Hi,

Whenver I am trying to create a new server runtime, RAD asks me for the installation directory however it doesn’t accept the installation path that I am specifying. Is there any specific folder within the installation directory which needs to be referenced for this path. Any pointers would be appreciated. Screenshot attached. I am feeling incredibly foolish but its something obvious which I am missing here....

Thanks,
Shamit.
10 years ago