Question: Please explain the pattern and why we used Integer . parseInt ( mr . group (3) ) in 12.5 and when to use it

 Please explain the pattern and why we used "Integer . parseInt

Please explain the pattern and why we used "Integer . parseInt ( mr . group (3) ) " in 12.5 and when to use it and when not.

12.4 Fill in the missing code String in - "Deadpoolu891-22-3954 "+ "Wadeu113-24-5566 "; Scanner s - new Scanner (in); while (s.hasNextLine)) String pattern = if(s.find InLine (pattern) . != nu11) { MatchResult mr - s.match (); int a = Integer.parseInt( int b = Integer.parseInt( int c = Integer.parseInt( String d = . mr.group (2) mr.group (3) mr.group (4) ) ); ): mr.group (1) System . out. print f ("Name : u%s , ussn :u%d-%d-%d%n" , d, a, b, c) ; J s.nextLine (); // output: Name: Deadpool, ssn: 891-22-3954 Name: Wade, ssn: 113-24-5566 12.5 Fill in the missing code String in = "MoDuJan, 2,?1982 WeduAuEu14,u1979 "; Scanner s new Scanner (in); while (s.hasNextLine)) String pattern - -- if (s.findInLine (pattern) !- null) [ MatchResult mr - s.match ) String weekday . String month = . int day- mr . group (1) mr.group (2) Integer.parseInt (mr.group (3)) Integer .parseInt (mr . group (4)) nt year - System . out . printf "Date :uZsu%d/Xs/%d%n", weekday, day , month , year) ; else t System. out.println ("Incorrect") j s.nextLine O; // output: Date: Mon 2/Jan/1982 Date: Wed 14/Aug/1979

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!