Select the only correct program output when it is run by a "java Test 1 two 3" command.

public class Test {
    static public void main(String[] args) {
        try {
            int k = Integer.parseInt(args[1]);
        catch (Exception e) {

Array of strings containing the parameters specified when launching the application from the command line is passed to the main() method:
args[0] → "1"
args[1] → "Two"
args[2] → "3"

NumberFormatException will be thrown when attempting to execute an Integer.parseInt("Two") command.

Arguments can be specified even when launching an application from IDE. For example, in Netbeans IDE they are specified in "Project properties" - "Run" - "Arguments".

Следи за CodeGalaxy

Мобильное приложение Beta

Get it on Google Play
Обратная Связь
Продолжайте изучать
тесты по Java
Зарегистрируйся сейчас
или Подпишись на будущие тесты