Observe the below code developer by John. He's getting a Warning Line 4 as "The value of the local variable intValue is not used". Help John to supress that warning.
//Line 1
public class Tester {
//Line 2
public static void main(String[] args) {
//Line 3
int intValue = 0; //Line 4: Warning: The value of the local variable intValue is not used
String strValue = "John";

System.out.println(strValue);
}
}

Which of the following approaches John can follow to suppress the Warning occurring at Line 4?

@SuppressWarnings("unused") can be used at any one of the places - Either at Line 1 OR at Line 2 OR at Line 3

@SuppressWarnings("unused") can only be used at Line 1

@SuppressWarnings("unused") can only be used at Line 2

@SuppressWarnings("unused") can only be used at Line 3

Correct Option - a

To get all Infosys Certified Java SE8 Developer Exam questions Join Group https://bit.ly/infy_premium_group

We're passionate about offering best placement materials and courses!! A one stop place for Placement Materials. We daily post Offcampus updates and Placement Materials.

Qtr No. 213, New Town Yehlanka Indore 454775

admin@prepflix.in