Mathangi Shankar

Ranch Hand
+ Follow
since Nov 01, 2004
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Mathangi Shankar

But how it is possible.I check for hasNext and then call next method of the iterator
Here is my code;-

if (listt != null && listt .size() > 0) {

Iterator it = listt.iterator();
while (it.hasNext()) {
Object obj = (Object) it.
next();
// Do some stuff here.....
}




}
Hi,

I get java.util.NoSuchElementException while calling the Iterator's next element though I am checking for Iterator hasNext method before calling the next method.

Please suggest how this exception could be handled.
Hi All,

It was a great experience giving this exam. I have done most of the mock exams and prepared for approximately 3 months.

I read Khalid Mughal twice.

Thanks,

Mathangi.
19 years ago
Hi Dudes,

Thanks a lot for all your answers. Finally I got one thing clear that declaration and initialization in seperate statements is illegal.

However I one doubt in what Sanju has answered. You said that class for variables and instance variables declaration and initialization in seperate statements is illegal but for member variables it holds good.

Can you quote me an example please where member variables are used in such a case?

Thanks,

Mathangi.
Hi Prasad,

In evaluation of boolean expressions involving conditional AND and OR, the left-hand operand is evaluated before the right one, and the evaluation is short-circuited.

I hope now it is clear.

Thanks,

Mathangi.
&& has higher precedence than || operator.

In the bitwise operators folloing is the sequence of precedence of operators in descending order

&,^,|

Thanks,

Mathangi
Hi Sagar,

I think the explaination you have is viceversa. Please check. Correct me if I am wrong.

Mathangi.
Hi purnima,

The compiler doen't give error because a++ is a reachable statement. The reason being the whiteexception thrown in the method m1 is declared in the throws clause of the method

So in a way it is directly being absorbed hence the next line is executed.

The exception thrown is carried till a corresponding catch block is found.

Note:You cannot catch a WhiteException following the ColorException the compiler will throw error.
Are there any more rules regarding initialization of arrays that we need to do in a local method only.

Thanks,
Mathangi
Hi,

Please let me know in the following code at the commented line why does the compiler give error?

We are just assigning a value in the array of type int!!!

class ArrayTest {

static int [ ] intArray = new int [5] ;
static int[ ] intArray1 = new int [1] ;

// intArray1[0] = 5;
static char [ ] charArray = new char [5] ;

public static void main (String [ ] args) {
System.out.println (charArray [1] ) ;
intArray1 = intArray ;
}
}
Hi,

In the first try block the method m1 is called since the method body throws WhiteException which is a subclass of ColorException it is caught in the corresponding catch block and 'b' is incremented to 1.

In the second try block when the method m2 is called though the exception is declared in the throws clause the method body does not throw any exception hence the next line is executed.

Therefore d is incremented to 1.

Since all the exceptions are handled properly the println statement is executed outputting 0,1,1,0 as a=0,b=1,d=1,f=0


Hope you understood the flow.

Mathangi....
Hi All,

I am giving my exam on the comming Saturday. Just to confirm whether the details given on Sun site the number of questions = 61 and the passing score = 52%, timelimit is 120 minutes is all the updated one.

I have seen somewhere that the exam's objectives will be changed. Please guide me the correct objectives with the link to view them.

It would be of great help if I get the link to view objectives of SCJP1.4.

Thanks,

Mathangi.
Thanks I got the output
hi Ajay,

I went through the discussion but I want to know conversion of hexadecimal to binary so that I can go further for the shift operation.

Thanks,

Mathangi.
class EBH019 {
public static void main (String args[]) {
int i1 = 0xffffffff, i2 = i1 << 1;
int i3 = i1 >> 1, i4 = i1 >>> 1;
System.out.print(Integer.toHexString(i2) + ",");
System.out.print(Integer.toHexString(i3) + ",");
System.out.print(Integer.toHexString(i4));
}}

Hi,

Can anybody explain me the output of the above code:
Prints: fffffffe,ffffffff,7fffffff