Cleared SCJP5 today with 91%.
Split Up:
Declarations, Initialization and Scoping – 100
Flow control : 81
API : 100
Concurrency : 87
OO concepts: 90
Collections / Generics : 90
Fundamentals : 90
Cleared SCJP5 today with 91%.
Split Up:
Declarations, Initialization and Scoping – 100
Flow control : 81
API : 100
Concurrency : 87
OO concepts: 90
Collections / Generics : 90
Fundamentals : 90
if in finalized method, there is a call to super(), then handle the throwable in the finalize method of the class, as the finalize of Object class throws Throwable.
synchronization possible on objects only and not on primitives
int x;
synchronized(x) will be compiler error. No autoboxing here…
StringBuffer sb = “hello”;
this won’t compile. StringBuffer have to be explicity created by new operator.
When class implements two or more interface(or extends classes) containing same member varaible type(say, int i). Referencing this variable in the new class will cause ambiguous match for compiler as long as that variable is not redefined in the new class. Redefining the variable in new class will resolve the issue.
Not possible to access methods of private inner class as the following code will give compile error.
class MyOuter{
private class MyInner{
public float f(){return 1.2f;}
}
public MyInner getMyInner(){
return new MyInner();
}
}
public class Test13{
public static void main(String... args){
MyOuter o = new MyOuter();
float f = new MyOuter().getMyInner().f();
}
}
For %b(boolean) : All data types can be passed
For %c(char) : byte, char, short, int
For %d(int) : byte, short, int, long (No char)
For %f(float) : only float and double
For %s(string) : everything
=======================================
public class Test12{
public static void main(String… args){
boolean b = false;
byte by = 2;
char c = ‘A’;
short s = 7;
int i = 35565;
long l = 2345676436323746l;
float f = 234.567f;
double d = 234.678;
//System.out.printf(“%d\t”, b);
System.out.printf(“%d\t”, by);
//System.out.printf(“%d\t”, c);
System.out.printf(“%d\t”, s);
System.out.printf(“%d\t”, i);
System.out.printf(“%d\t”, l);
//System.out.printf(“%d\t”, f);
//System.out.printf(“%d\t”, d);
System.out.println();
System.out.printf(“%b\t”, b);
System.out.printf(“%b\t”, by);
System.out.printf(“%b\t”, c);
System.out.printf(“%b\t”, s);
System.out.printf(“%b\t”, i);
System.out.printf(“%b\t”, l);
System.out.printf(“%b\t”, f);
System.out.printf(“%b\t”, d);
System.out.println();
System.out.printf(“%s\t”, b);
System.out.printf(“%s\t”, by);
System.out.printf(“%s\t”, c);
System.out.printf(“%s\t”, s);
System.out.printf(“%s\t”, i);
System.out.printf(“%s\t”, l);
System.out.printf(“%s\t”, f);
System.out.printf(“%s\t”, d);
System.out.println();
//System.out.printf(“%f\t”, b);
//System.out.printf(“%f\t”, by);
//System.out.printf(“%f\t”, c);
//System.out.printf(“%f\t”, s);
//System.out.printf(“%f\t”, i);
//System.out.printf(“%f\t”, l);
System.out.printf(“%f\t”, f);
System.out.printf(“%f\t”, d);
System.out.println();
//System.out.printf(“%c\t”, b);
System.out.printf(“%c\t”, by);
System.out.printf(“%c\t”, c);
System.out.printf(“%c\t”, s);
System.out.printf(“%c\t”, i);
//System.out.printf(“%c\t”, l);
//System.out.printf(“%c\t”, f);
//System.out.printf(“%c\t”, d);
}
}
========================
Output:
2 7 35565 2345676436323746
false true true true true true true true
false 2 A 7 35565 2345676436323746 234.567 234.678
234.567001 234.678000
A ?
Advantages of encapsulation:
Good Link for on Oracle collection : http://sheikyerbouti.developpez.com/collections/collections.htm