Originally posted by Siddharth Bhargava:
Originally posted by Juva Yuva:
Thats because you declared the method (factorial) as Class method. And since main is static , methods can be called directly . Otherwise It can be accessed in non-static way , by creating instance of the class.
1) Try creating an instance of the class in the main method , call the factorial method with the instance.
2)And remove the static modifiers from the methods
Originally posted by Rob Prime:
To be even more precise:
No need for the else here. I even set up my Eclipse to warn me if I use unnecessary else blocks.
Originally posted by seetharaman venkatasamy:
1.two different browser-----------> then two different session id
2.two different window from same browser-----------> then only one session id
Hope this helps![]()
Originally posted by Steve Fahlbusch:
The code inside the method can be reduced to:
Originally posted by Juva Yuva:
What are the basic steps to create Immutable classes ?
1) Declaring the class as final so as to avoid subclassing and overriding
2) Declaring the accessor methods for the instance variables
3) Making the instance variables private.
Is that all.Anything i missed ?
[ December 25, 2008: Message edited by: Juva Yuva ]
Originally posted by Suresh Rajadurai:
Hi Folks,
Is there any method to get the type of the variable (primitive)? Something like this:
Originally posted by Dikesh Stha:
without formation of objects of super classes sub class objects can not be created and cannot be able to access class variable..Is this right or not??
dikesh
With a subclass, you can access all protected variables of the super class -- not only for the "this" instance, but for any instance passed into it as well. However, the instance that is passed to it, must be at least of the type of the subclass.