Question: Based on following given program analyze code, determine the problem, and propose a solution. import java.io.File; import java.io.Exception; import java.io.PrintWriter; import java.util Scanner; public class
Based on following given program analyze code, determine the problem, and propose a solution. import java.io.File; import java.io.Exception; import java.io.PrintWriter; import java.util Scanner; public class Final { public static void main (String[] args){ Scanner sc=new Scanner(System.in); System.out.println("enter manager first name"); String fname=sc.next(); System.out.printin("enter manager last name"'); String Iname=sc.next(); System.out.println("enter manager id"); int id=sc.nextInt(); PrintWriter output = new PrintWriter(myfile); output.printIn(fname+","+Iname+","+id); output.close(); System.out.println("file created"); try { if(myfile. exists()) { while(input.hasNext()) { String s=input.next(); Scanner scn=new Scanner(s); String fname=next(); System.out.printIn("manager first name=" +fname); System.out.println("manager last name="+Iname); System.out.println("manager id= " +id); } } } } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
