PROG24178 Study Guide - Quiz Guide: Netbeans, Code Segment, Local Variable

414 views6 pages

Document Summary

Refer to the main method below for numbers 1,2, and 3. public static void main(string[] args) { 1 2 : 1, 2, 3, 1 2, none of the above. If we run this on netbeans, we are typing in 1 2 which is read in as a string, and integer. parseint tells us to convert this number to an integer. Args at position zero tells us to consider 1 2 as its first argument. 2: 1, 2, 3, 1 2, none of the above. We are telling the compiler to convert 1 2 into an integer, which can be done. The compiler stores it into an integer array, where args[0]=1 and args[1]=2 as in the above example. 1+: 1, 2, 3, 1 2, none of the above. The correct answer is e, none of the above. Again, 1++ is not a number, it cannot be converted to an integer, so we get a number format exception.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers

Related Documents

Related Questions