Win a copy of Securing DevOps this week in the Security forum!

pitambari parekh

Greenhorn
+ Follow
since Jul 06, 2007
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 pitambari parekh

Looks like no one's aware of how RMI works in jdk5.0 ...
anyways who so ever reads this and if interestd must try to run RMI application in jdk5.0 and not use "rmic" at all.....
10 years ago
For rmi , in java 5.0 "rmic" is not required. The stub is an instance of java.lang.reflect.Proxy which is created dynamically. Can someone please explain the working of it exactly???
I hope m clear with the question...

Regards,
Pitambari.
(SCJP5.0)
10 years ago
does the main thread die??
If so, how???
please help me with..
Thanks..

Regards,
Pitambari.
Thanks Mr. Ernest Friedman-Hill.
I wasn' t getting a satisfactory answer immediately and so I put the same question on another forum.
Anyways I assure you that this won�t happen again from my end.


Regards,
Pitambari.
10 years ago
Thanks Raghavan Muthu.. Thats a good link
10 years ago
No Dhwani, thats not the case..
If they are inherited why cant they be overriden??
The main reason why static methods cannot be overridden are that they are not inherited in sub class...
And the reason why they are not inherited is that they are class's methods and not of object..
10 years ago
In the code "k" is a static variable of Super class.
It should not be visible in the Sub class.
Atleast not when I write "this.k" And even when I write "m.print()" , i should get a compiler error... But i do not get any error...
Why so?? Please give me a good example saying that it is not inherited.
Waiting for an early reply...

class Super
{
int i =1;
static int k = 2;
public static void print()
{
System.out.println(k);
}
}

class Sub extends Super
{
public void show()
{
System.out.println(" k : " + this.k);
}
public static void main(String []args)
{
Sub m =new Sub();
m.show();
m.print();
}
}
10 years ago
In the code "k" is a static variable of Super class.
It should not be visible in the Sub class.
Atleast not when I write "this.k" And even when I write "m.print()" , i should get a compiler error... But i do not get any error...
Why so?? Please give me a good example saying that it is not inherited.
Waiting for an early reply...

class Super
{
int i =1;
static int k = 2;
public static void print()
{
System.out.println(k);
}
}

class Sub extends Super
{
public void show()
{
System.out.println(" k : " + this.k);
}
public static void main(String []args)
{
Sub m =new Sub();
m.show();
m.print();
}
}
10 years ago
Thanks John Dell'Oso ...
Just to confirm what i've understood is that(only from the accessible point of view) static variables and methods are kept with class file of super class and so are accessible in sub class...

They are not inherited ...

And when i'm printing "k" or calling "print()" in my code, internally it is read as " Super.k " and " Super.print()"

Please let me know if I'm right???
Thanks ...
10 years ago
The code runs perfectly.. And thats the reason i have a Doubt...

I'm very sure that static members are not inherited.
I just want a reason how am i able to print static members of super class in my sub class??
If i'm able to print, means these static members are visible in my sub class, means they are inherited which contradicts the statement that static members are not inhrited..
10 years ago
Are static variables and methods of super class inherited in sub class???
according to me they aren't...
But how can we use the static variables in our sub class??
Means are they visible to subclass ??
class Super
{
int i =1;
static int k = 2;
public static void print()
{
System.out.println(k);
}
}
class Sub extends Super
{
public void show()
{
System.out.println(" k : " + k);
}
public static void main(String []args)
{
Sub m =new Sub();
m.show();
print();
}
}
10 years ago
"throw" and "throws" are two different keywords..
When you use "throws Exception" , you are basically indicating that you are not catching the exception in that method and it should be thrown to the calling method and you must write your catch in that calling method.

When you use "throw new Exception()" , you are explicitly throwing an exception which has to be caught. You basically use this when you dont want to reach to a particular condition.Means if that particulr condition occurs "throw new Exception()" .....
10 years ago
Thank You Mr. Campbell Ritchie .. But one thing i would like to clarify is that by using Printable I meant simply any interface and not specifically the interface from java.awt.print.Printable..
10 years ago
Thank you, Mr Friedmann-Hill..
10 years ago
class Employee implements Printable
{
public void print()
{
System.out.println("inside print");
}

public Employee()
{

}

public static void main(String[] args)
{
Printable p1 =new Employee();
Printable p2 =new Employee();
p1.print();
if(p1.equals(p2))
System.out.println("Equal");
System.out.println("Not Equal");
}
}
how is it possible to call "equals" method on Printable reference??? Because with super class/interface reference we can only call methods of super class/interface .. And "Object" class is not a super class for Printable.
Waiting for a reply...
10 years ago