Question: Please explain/comment this code import java.util.*; public class month { int monthinput() { Scanner s=new Scanner(System.in); return(s.nextInt()); } String monthname(int n) { String a; if(n==1)

Please explain/comment this code

import java.util.*; public class month {

int monthinput() { Scanner s=new Scanner(System.in); return(s.nextInt()); } String monthname(int n) { String a; if(n==1) { return ("january"); } if(n==2) { return("febrauary"); } if(n==3) { return("march"); } if(n==4) { return("april"); } if(n==5) { return("may"); } if(n==6) { return("june"); } if(n==7) { return("july"); } if(n==8) { return("august"); } if(n==9) { return("september"); } if(n==10) { return("october"); } if(n==11) { return("november"); } if(n==12) { return("december"); } return null; } void displaymonth(String ss) { System.out.println("the given month is"+" "+ss); } }

driver programme is

public class driver {

public static void main(String args[]) { month m=new month(); int x=m.monthinput(); String s=m.monthname(x); m.displaymonth(s); } }

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!