Answer to Question #184702 in Java | JSP | JSF for salma wael

Question #184702

Use method overriding to write two methods called printArray. On should take an int array and the other should take a double array. Both should print the array they are given as an argument


1
Expert's answer
2021-04-23T13:19:00-0400
public class Main
{
	public static void main(String[] args) {
	    int integerArray[]={5,6,8,3};
	    double doubleArray[]={23.3,6.6,8.3,3.3};
	    System.out.println("Integer array: ");
	    printArray(integerArray);
	    System.out.println("\nDouble array: ");
	    printArray(doubleArray);
	}
	static void printArray(int integerArray[]){
	    for(int i=0;i<integerArray.length;i++){
	        System.out.println(integerArray[i]);
	    }
	}
	static void printArray(double doubleArray[]){
	    for(int i=0;i<doubleArray.length;i++){
	        System.out.println(doubleArray[i]);
	    }
	}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS