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
State what is encapsulation and friend function?
Can enum be null?
What is stream in oop?
Why is oop useful?
design a c++ class for the chess board,provide a c++ class definition for such class(only class definition is required)
What is difference between polymorphism and inheritance?
Can main method override?
What is an advantage of polymorphism?
What is solid in oops?
What exactly is polymorphism?
Can destructor be overloaded?
What is oops in simple words?
Why do we use oops?
given a set based questions and 5 questions based on it next data sufficiciency questions 2 and 2/3 english sentence completion with options very easy and 2 synononmys paragraph with 10 questions 10 minutes replace =,-,*,% with -,%,+,* type questions 5 3 questions lik following itssickhere itssickthere itssickhere istsickhere which is nt alike the others very easy
class type to basic type conversion