MCQOPTIONS
Bookmark
Saved Bookmarks
→
Java Programming
→
Exceptions
→
What is the output of this program?
1.
What is the output of this program?
A.
1 25
B.
20 1
C.
30 20
D.
25 1
E.
1 20
Answer» E. 1 20
Show Answer
Discussion
No Comment Found
Post Comment
Related MCQs
What is the output of this program?class box_area { int w; int l; int h; box_area() { w = 7; l = 4; h = 2; } void volume() { int vol = w * h * l; System.out.println(vol); } } public class cons_method { public static void main(String args[]) { box_area obj = new box_area(); obj.volume(); } }
What is the output of this program?class modifier { static int p; static int q; void addition(int n1 , int n2) { p = n1 + n2; q = p + n2; } } public class static_use { public static void main(String args[]) { modifier obj1 = new modifier(); modifier obj2 = new modifier(); int n1 = 5; obj1.addition(n1, n1 + 3); obj2.addition(7, n1); System.out.println(obj1.p + " " + obj2.q); } }
What is the output of this program?public class Result { static void main(String args[]) { int p , q = 1; p = 20; if(p != 20 && p / 0 == 0) System.out.println(q); else System.out.println(++q); } }
What is the output of this program?
What is the output of this program?class access_Example { public int p; private int q; void calc(int n1, int n2) { p = n1 + 1; q = n2; } } public class access_specifier { public static void main(String args[]) { access_Example obj = new access_Example(); obj.cal(5, 7); System.out.println(obj.p + " " + obj.q); } }
What is the output of this program?class static_Access { static int p; static int q; void add(int n1, int n2) { p = n1 + n2; q = p + n2; } } public class static_output { public static void main(String args[]) { static_Access obj1 = new static_Access(); static_Access obj2 = new static_Access(); int n1 = 5; obj1.add(n1, n1 + 2); obj2.add(6, n1); System.out.println(obj1.p + " " + obj2.q); } }
What is the output of this program?class modifier { static int p; void method() { p++; } } public class static_keyword { public static void main(String args[]) { modifier obj1 = new modifier(); modifier obj2 = new modifier(); obj1.p = 5; obj1.method(); obj2.method(); System.out.println(obj1.p + " " + obj2.p); } }
What is the output of this program?class Modifier { public int p; static int q; void cal(int n1, int n2) { p += n1; q += n2; } } public class static_keyword { public static void main(String args[]) { Modifier obj1 = new Modifier(); Modifier obj2 = new Modifier(); obj1.p = 2; obj1.q = 3; obj1.cal(4, 5); obj2.p = 4; obj2.cal(4, 6); System.out.println(obj1.p + " " + obj2.q); } }
What happens if constructor of class N is made private?
Can a class be declared with protected modifier?
Reply to Comment
×
Name
*
Email
*
Comment
*
Submit Reply
Your experience on this site will be improved by allowing cookies. Read
Cookie Policy
Reject
Allow cookies