Given: 3. public class TestDays { 4. public enum Days { MON, TUE, WED }; 5. public static void main(String[] args) { 6. for(Days d : Days.values() ) 7. ; 8. Days [] d2 = Days.values(); 9. System.out.println(d2[2]); 10. } 11. } What is the result? (Choose all that apply.)
TUE
Wed
The output is unpredictable
Compilation fails due to an error on line 4
Compilation fails due to an error on line 6
Compilation fails due to an error on line 8
What is the output of the following StringBuffer sb1 = new StringBuffer("Amit"); StringBuffer sb2= new StringBuffer("Amit"); String ss1 = "Amit"; System.out.println(sb1==sb2); System.out.println(sb1.equals(sb2)); System.out.println(sb1.equals(ss1)); System.out.println("Poddar".substring(3));
false false false dar
false true false Poddar
Compiler Error
true true false dar
Which of the following are primitive types?
byte
String
integer
Float
What is the output (Assuming written inside main) String s1 = new String("amit"); String s2 = s1.replace('m','i'); s1.concat("Poddar"); System.out.println(s1); System.out.println((s1+s2).charAt(5));
Compile error
amitPoddar O
amitPoddar I
amit I
What is the output of following (Assuming written inside main) String s1 = "Amit"; String s2 = "Amit"; String s3 = new String("abcd"); String s4 = new String("abcd"); System.out.println(s1.equals(s2)); System.out.println((s1==s2)); System.out.println(s3.equals(s4)); System.out.println((s3==s4));
True true true false
True true true true
True false true false
False false true false
Which one does not extend java.lang.Number
Integer
Boolean
Character
Long
If the method to be overridden has access type protected, choose access types among the following that a subclass can have,
Protected
Private
Public
Public & private
Protected & Public
While serializing a class whose Base class is serializable, which of the following fields are ignored?
Non Static field
Base class fields
Transient Fields
none
JSP expressions should be enclosed within
Predefined variables are also called as
scriptlets
declarations
implicit objects
expressions