rohit shekhar

Ranch Hand
+ Follow
since Mar 05, 2010
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by rohit shekhar

[Added code tags, please see UseCodeTags for more details]
// page - 671, here y is a stack variable and when method(here method()) ends jvm erase stack entry for
// same but inner class object is still alive in heap so if we wants to access y we need to makes y as final.
// how it works? i.e. does it mean if y is final jvm does not bothers whether y exists or not in memory??
Sorry greg for less appropriate title actually nothing clicked in mind for title so.. Thanks for your reply... Still one doubt, mostly we will use 'a' instead of 'b'. Any advantage?



both a and b behaves similarly but what is the difference?
The case constant must be a compile time constant!

Code :-

Q. Both variables are being initialized before use. And I think both have value before compilation. Then why b is not compile time constant.

Ref. SCJP java 6 study guide. Page 336


above code is generating error unless x is not final. In book what they explained I am not able to understand. Please explain.
it is one of the limitation of extending thread. In comparison of implementing Runnable. Ya got it now. It is saying that we can't extend anything in that particular class where we are trying to extend it. Thanks.



Above code will add one String in an Integer type ArrayList. Why same logic gives here error in main if we will remove comment.
I was trying this...
In a common package (in eclipse) i placed two files as follows:-

1) p1.java

public class p1 {
public static void main(String[] args)
{
System.out.println("Hello!");
p2 p = new p2();
p.disp();
}
}
class p2
{
void disp()
{
System.out.println("From class p2");
}
}

2) p2.java

class p3
{
// strange!! execute this file we will get output of p1.java
}
class p4
{

}



if we will execute p2.java it shows output of p1.java
please explain.
Actually i have used three frameset in my project in every window. In first frameset there is one link named as logout. If I will click on logout it should show login window again. But problem is that Login window comes in that frame only. Other frames remains unaffected. What should I do to achieve result.
ya java is awesome i love it... but for placement purpose i have to study c++ too.
14 years ago
can any one please say me is there any forum for CPP like this forum.
14 years ago
in c++, "the only difference between a class and a struct is that by default all members are public in a struct and private in a class. In all other respect, structures and classes are equivalent." for only this difference what is the need of class we can achieve everything using struct only i think...
14 years ago
ya following the same book but ... 'm trying to understand... thanks