Question
21. What access specifiers are available in Java? 22. Does garbage collection guarantee that a program will not run out of memory? 23. Why would
21. What access specifiers are available in Java?
22. Does garbage collection guarantee that a program will not run out of memory?
23. Why would one use a PrepartedStatement versus a Statement?
24. Read the following program:
public class test { public static void main(String [] args) { int x = 3; int y = 1; if (x = y) System.out.println("Not equal"); else System.out.println("Equal"); } }
Please choose the correct result from the choices below.
A. The output is ?Equal?
B. The output in ?Not Equal?
C. An error at " if (x = y)" causes compilation to fall.
D. The program executes but no output is show on console.
25. Review the following code, what is output?
public class EqualsTest { public static void main(String[] args) { String s1 = abc; String s2 = s1; String s5 = abc; String s3 = new String(abc); String s4 = new String(abc); System.out.println(== comparison : + (s1 == s5)); System.out.println(== comparison : + (s1 == s2)); System.out.println(Using equals method : + s1.equals(s2)); System.out.println(== comparison : + s3 == s4); System.out.println(Using equals method : + s3.equals(s4)); } }
26. What is the difference between instanceof and isInstance?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started