in a constructor what happen if u call super and this in
the same class? i know that it is not possible to call
both in the same one? if we call what will happen?
Answer Posted / agile being
The question clearly specifies "what happen if u _CALL_
super and this in the same class"
By call, probably, they mean:
this(); /*Invoking the constructor*/
super(); /*Invoking the parent class's constructor*/
I think the right answer is that it will raise a compiler
exception. Such a program will not compile.
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
Why do we need variables?
What is anagram word?
What is the relationship difference the canvas class and the graphics class?
What type of language is java?
What do you mean by mnemonics?
What variables are stored in stack?
What is use of valueof () in java?
What are constants?
Does treeset allow null in java?
Why doesn't the java library use a randomized version of quicksort?
How to use string tokenizer class.
What do you understand by the term string pool?
public class Test { public static void main(String[] args) { int countA = 0; int countB = 0; int countC = 0; int countD = 0; int countE = 0; int countF = 0; int countG = 0; int countH = 0; int countI = 0; int countJ = 0; int countK = 0; int countL = 0; int countM = 0; int countN = 0; int countO = 0; int countP = 0; int countQ = 0; int countR = 0; int countS = 0; int countT = 0; int countU = 0; int countV = 0; int countW = 0; int countX = 0; int countY = 0; int countZ = 0; } } Can anybody tell me any alternate solution(like loop or something) to automate this initialization process. Ex:- for(char chr='A';chr<='Z'; chr++) { (int) String "count"+chr = 0; }
Can we write method inside a method in java?
Can we modify the throws clause of the superclass method while overriding it in the subclass?