Q.– Given:
public class App {
int count;
public static void displayMsg ( ) {
System.out.println("Welcome Visit Count: " + count++); // line n1
}
public static void main(String[] args) {
App.displayMsg();
displayMsg (); // line n2
}
}
What is the result?
A) Compilation fails at line n1
B) Welcome Visit Count: 0
Welcome Visit Count: 0
C) Compilation fails at line n2
D) Welcome Visit Count: 0
Welcome Visit Count: 1
⧪ please give your answer in a comment section.
public class App {
int count;
public static void displayMsg ( ) {
System.out.println("Welcome Visit Count: " + count++); // line n1
}
public static void main(String[] args) {
App.displayMsg();
displayMsg (); // line n2
}
}
What is the result?
A) Compilation fails at line n1
B) Welcome Visit Count: 0
Welcome Visit Count: 0
C) Compilation fails at line n2
D) Welcome Visit Count: 0
Welcome Visit Count: 1
⧪ please give your answer in a comment section.
1 Comments
A
ReplyDelete