Bandi Chandrasekhar Reddy
class A is there i want restrict this class , without creating an Object how can do?, it should be inheritance possible, & should not be instanciated.?
View Answers
September 6, 2012 at 3:57 PM
You can restrict the class by making the constructor of a class private.Since the private modifier is accessible withing the class, when a class outside this class tries to instantiate this class it gives error as the class cannot be instantiated.
You can also restrict the class by giving abstract key word to the class. Only abstract classes can not be instantiated.
Related Tutorials/Questions & Answers:
Bandi Chandrasekhar Reddy Bandi Chandrasekhar Reddy class A is there i want restrict this class , without creating an Object how can do?, it should be inheritance possible, & should not be instanciated.?
You can restrict the class
Advertisements
java - AOPjava Hi RoseindiaTeam,
sub: difference between class loading and execution time in spring?
Thank You.
Ramesh
Reddy T
features - Java Beginnersfeatures How can i use the dictionary in Java.Is there this feature in C if so inform me..
thank you.....
regards..
cheruvu Jaanu
Reddy java code - Development processjava code hi,
this is sampath, how to acchive the batch processing in java or batch process base java thread. can u send the code and brief explanation.
thanks and regards
sampath
reddy java and xml - XMLjava and xml Hi Deepak,
I want learn xml and java(applications).
Which editor is best usefull(trial--version) in my applications.
(myeclipse--how it is help to me?)
Thank You.
Ramesh
Reddy T.
java - Frameworkjava
Hi
this is samapth
reddy, iam using struts2 framework. Am not able to understand the Interceptor.what is the use of it and where we use... the brief explanation of this(with example).
thnaks and regards
sampath
reddy java - Java Interview Questionsjava
hi
This is sampath
reddy, i didnot get the idea i.e some of the elements in integer type of Array,how to find the second highest numnber in that array (condition is using only one loop and with out using