Best writers. Best papers. Let professionals take care of your academic papers

Order a similar paper and get 15% discount on your first order with us
Use the following coupon "FIRST15"
ORDER NOW

Hello. I am creating a generic code that is supposed to display a

Hello. I am creating a generic code that is supposed to display a

list of months and years. I am trying to use <T> to print out the lists, but it does not seem to be working. I am new to this method, so is it the right application? Should I be using something else? Any help is appreciated.

/** * File: Discussion7a.java * Author: Lutz, Zechariah * Date: 7 December 2019 * Purpose: Show the difference between generic and non generic: * generic method */ public class Discussion7a { public static void main(String[] args) { // Objects to display month and year String[] month = {“January” , “February” , “March” , “April” , “May” , “June” , “July” , “August” , “September” , “October” , “November” , “December”}; int[] year = {2010 , 2011 , 2012 , 2013 , 2014 , 2015 , 2016 , 2017 , 2018 , 2019 , 2020}; displayDate(month); displayDate(year); } public static <T> void displayDate(T[] x){ for (T i: x) System.out.printf(“%s”, i); } }

 
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"