Question: Are the methods in the following code correctly overloaded? public class Prog2 { public void m(String s, int i) {} public void m(int i, String

Are the methods in the following code correctly overloaded?

public class Prog2 { 
 public void m(String s, int i) {} 
 public void m(int i, String s){} 
} 

True/False

Assume the following class has been implemented:

public class Tool { 
 public static double log(double b, double x) { 
 return Math.log10(x)/Math.log10(b); 
 } private Tool() {// to prevent instantiation of the class throw new RuntimeException("This class cannot be instantiated"); } 
 } 

In another class, you want to use the log method in Tool class. Which statement uses the method correctly?

1 double X = Math.log(2,8);

2 double x = Tool.log(2,8);

3 double x = log(2,8);

4 double x = (new Tool()).log(2, 8);

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!