Nirodha Abeywardana

+ Follow
since Dec 12, 2006
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Nirodha Abeywardana

Anybody used Paul Singhera - Manning Publication book ?
I am going to start with SCBCD 1.3. What are the books available for that exam. Do you have any idea about Paul Singhera's book(Manning Publication). pls help me.
byte b = 27;

but only because the compiler automatically narrows the literal value to a byte if it is a compile time constant.The preceding code is identical to the following:

byte b = (byte) 27;

byte b = 3; // No problem, 3 fits in a byte
byte c = 8; // No problem, 8 fits in a byte
byte d = b + c; // Should be no problem, sum of the two bytes fits in a byte

But this gives a compiler error since "b+c" is not a compiler time const.
In this case you have to exlicitly cast as
byte c = (byte) (a + b);

byte d = 3 + 8; // This compiles successfully, since 3+8 is a compiler time const

"=" operator implecitly cast it if it can hold
short sh1 = (short)1 - (short)2;//1
Short sh = new Short((short)1 - (short)2);//2

(short)1 - (short)2 returns an int type, return value will be implecitly cast to short if it is enough to hold so line 1 compiled correctly.
But in line 2 there is no constructor for new Short(int) so compiler error given
Although there is significant overlap with the JDK 1.4 exam I guess that there is at least 30% new material to learn. Some of the new topics are

regular expressions
the Locale class
the Text class
serializing streams
generic collections
generic method parameters
input/output classes
for-each looping
locales (dates and currencies)
OO concepts (coupling and cohesion)
jar files
sorting and searching collections
covariant returns
JavaBean naming
this is compiling with warnings. how this can be happan pls explain.
List myList = new ArrayList(); is same as List<Object> myList = new ArrayList<Object>();
method argument is type List<String>, but Object can not cast to String type implecitly

public class GenericsTest {
public static void main(String[] args) {
List myList = new ArrayList();
GenericsTest gt =new GenericsTest();

void takeListOfStrings(List<String> strings) {