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:
Verified
Q10: Which package, introduced with Java 8, provides
Q11: PrintWriter( File f) throws a FileNotFoundException.
Q12: A Stream can easily be constructed from
Q13: Large amounts of data reside in which
Q14: Which of the following methods in the
Q16: Your program will work as long as
Q17: FileNotFoundException is related to the Exception class
Q18: Sydney accidentally entered .5 instead of 5
Q19: When is it good practice to call
Q20: Professor Simmons had a text file of
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents