Can we override constructor in java?
Answer / Kamal Swaroop
No, constructors cannot be overridden in Java. However, a subclass can provide its own constructor that invokes the superclass's constructor using the super keyword.
| Is This Answer Correct ? | 0 Yes | 0 No |
What is the longest unicode character?
How can we break singleton in java?
public class Garbage { int a=0; public void add() { int c=10+20; System.out.println(c); System.out.println(a); } public static void main(String args[]) { Garbage obj=new Garbage(); System.gc(); System.out.println("Garbage Collected"); obj.add(); } } Above is a code in java used for garbage collection. object obj has been created for the class Garbage and system.gc method is called. Then using that object add method is called.System.gc method if called the obj should be garbage collected?
Difference between overloading and Overriding. <Giving a confusing example to test the concept.> (also asked in PA Consultancy Group,iflex,Value chain,IBM,CTS,Accenture, Tarang>
12 Answers Accenture, CTS, Extensio, IBM, iFlex, PA Consulting, Symphony, Tarang,
What modifiers may be used with a top-level class?
Can you declare the main method as final?
Is an object null?
Differentiate between postfix and prefix operators in java.
What do you mean by exception handling in Java?
What is polymorphism in java? What are the kinds of polymorphism?
can you create interface instance ?
What is the inheritance?