Solved

To Correct This Segment, Line 12 Should Be Changed to Int

Question 14

True/False

To correct this segment, line 12 should be changed to int n = 1;.
10 public static void main( String [ ] args )
11 {
12 int n;
13 String s = JOptionPane.showInputDialog( null,
14 "Enter an integer" );
15 System.out.println( "You entered " + s );
16
17 try
18 {
19 n = Integer.parseInt( s );
20 System.out.println( "Conversion was successful." );
21 }

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions