Question: 17. What is the main difference between an ArrayList and a Vector ? Which is better to use? 18. What is the difference between a
17. What is the main difference between an ArrayList and a Vector ? Which is better to use?
18. What is the difference between a while statement and a do statement?
19. What is the difference between checked and unchecked exceptions?
20. What are the different scopes for Java variables?
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
Get step-by-step solutions from verified subject matter experts
