subject
Computers and Technology, 08.03.2020 23:54 spobyyy

What will happen if the following program is run?

public class Test {
public static void main (String[] args) {
Test c = new Test();
c. m1();
}

public void m1() {
m2();
}

public void m2() {
String s = null;
System. out. println(s. toUpperCase());
}
}

1) A NullPointerException will be generated by method m2() and will stop in m2().
2) A NullPointerException will be thrown by method m2() and caught by method m1().
3) A NullPointerException will be thrown by method m2() and caught by main().
4) A NullPointerException will be thrown by method m2() and it will crash the program.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 22:00
You should try to photograph people on bright sunny days because the light will be best a) true b) false
Answers: 1
question
Computers and Technology, 22.06.2019 03:30
Which group on the home tab allows you to add shapes to a powerpoint slide?
Answers: 1
question
Computers and Technology, 22.06.2019 12:30
Which of the choices sean are not true when considering virus behavior
Answers: 1
question
Computers and Technology, 23.06.2019 20:00
How much current flows through the alternator brushes? a. 2–5 a b. 25–35 a, depending on the vehicle c. 5–10 a d. 10–15 a
Answers: 2
You know the right answer?
What will happen if the following program is run?

public class Test {
public stati...
Questions
question
Mathematics, 01.10.2021 16:10
question
English, 01.10.2021 16:10
question
Mathematics, 01.10.2021 16:10
question
Mathematics, 01.10.2021 16:10
question
Mathematics, 01.10.2021 16:10
Questions on the website: 13722363