Can we create object of class with private constructor?
Answer Posted / fareed
yes we can
public class Person{
privat Person(){
}
public hai(){
System.out.prinln("hai guys");
}
public static Person getobj(){
return new Person();
}
public class Manage{
public static void main(String[] args){
Person pr=Person.getobj();
pr.hai();
}
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
just right the logic of it 1--> If few people are electing then every time ur candidate should win 2--> arrange books in box, if box carry weight == books weight then take another box..... find the no of box required.
Whats oop mean?
write a program to find 2 power of a 5digit number with out using big int and exponent ?
What are the components of marker interface?
what's the basic's in dot net
Can private class be inherited?
What is overriding in oop?
What are constructors in oop?
How is polymorphism achieved?
What is class and example?
What is encapsulation process?
What is abstraction in oops?
Why polymorphism is used in oops?
Why is encapsulation used?
Write a c++ program to display pass and fail for three student using static member function