Java Problem: Program: Q10.19 Take a look at the method in LINE 26 which has a p
ID: 3607257 • Letter: J
Question
Java Problem:
Program:
Q10.19 Take a look at the method in LINE 26 which has a primitive type of double which behaves like function, does java has function? ANS : java has specific function statement just like LINE 26 (cycle: YES or NO ) ANS : java has no specific function statement instead it uses method to return the value (cycle: YES or NO ) When you activate (invoke) the class Cale_BMI by a main method (Line 41) with the invoking (Line 44) of a constructor in the class, how does the java loading system A1020 find out which constructor to be used for the initialization process? ANS: Q10.21 In Line 30, what is the function of this in + this. BMI) ? (ANS (1), can you omit the this word? (ANS (2) )? ANS (1): ANS (2): circle Yes or No Q10.22 There are two OP methods (LINE 28, 33) in the class with same name, and the driving main invokes both methods for console & GUI styles OP. How does the java distinguishing which one should be invoked? What is the function feature name that java uses to determine? ANS:Explanation / Answer
10.19
Ans: java has no specific function statement instead it uses methods to return the value..
Actually there is nothing like function, the methods itself are known as functions commonly.. so both are same.. tey are intended for taking some optional input and return some optional output.
10.20
Java loading system checks the number of parameters passed to the function. It first tries to match the method, which has exact same number of arguments and of same type.Whichever method matches, it invokes that. In this case, te method is taking 1 string and 2 int as input. It matches the constructor at line 16.
10.21
this keyword refers to the current object, in whose context this method is getting called. Yes, we can skip this keyword in this.BMI() call, as it directly calls the same BMI method defined in this class itself.
10.22
These are known as overloaded methods. One function takes some input and other doesn't take any. Hence on the basis of number of input paramteres passed during the invocation, java decides which method to be invoked. From line 45, it gets no input.. hence invokes method at line 28. From line 46, it invokes method of line 33.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.