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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!