Win a copy of Rust Web Development this week in the Other Languages forum!

K2 Joshi

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

Recent posts by K2 Joshi

hi,
can any one explain me the following code. is this the example for overloading or overriding?
class Base{
public void amethod(int i) { }
}
public class Scope extends Base{
public static void main(String argv[]){
}
//Method Here
}
1) void amethod(int i) throws Exception {}
2) void amethod(long i)throws Exception {}
3) void amethod(long i){}
4) public void amethod(int i) throws Exception {}

answer is 2,3
my question is overloading mathod is in the same class & overriding method in different class.
but here answer 2&3 which means overloading mathod in another class.can we do that? i was under impression that overloading method only occurs in same class.
can any one explain me?
Thanks
Ketu
what will be the output for following question.

public class Cat {
int iq;
public Cat ( ) {
}
Cat(int i) { iq = i;}
}
public class TestIt extends Cat {
final Cat c = new Cat (6);
public static void main(String[] args ) {
c = new Cat(4);
c.iq = 5;
System.out.println("Cat IQ = " + c.iq);
return;
}
}

Thanks
Ketu
Given that a java.io.IOException might occur when calling the read() method of the BufferedInputStream, you can handle the exception by:





a) Listing a java.io.EOFException in a throws list.

b) Catch the java.lang.Exception using the throw statement.

c) Catch a java.io.EOFException using a try/catch clause.

d) Catch a java.lang.Exception using a try/catch 3

can any one help me about this problem.
Thanks in advance
Ketu
Thanks Everybody, so the final answer is all will compile but only a& b will run fine.
ketu
can any one please explain me which one is the valid statement & will compile fine.
a)String s = null; boolean y = true; if(y | | s.length()>0){}

b)String s = null; boolean y = false; if(y && s.length()>0){}

c)String s = null; boolean y = true; if(y && s.length()>0){}

d)String s = null; boolean y = false; if(y | | s.length()>0){}
Thanks in advance
Ketu
I am trying to solve this question can any one help.
int a = 5, b= 7 , c = 9
a= a^b^c;
what will be the answer & how.
Also do you where can i find the answer for ibm mock exam.
Thanks in advance
Ketu
Thanks a lot , I have got it clear.
byte b = 11;
byte b1 = 12;
b = b * b1 ; ( everything is byte then how it is converting to int.)
can any one help me?
Thanks in advance
Ketu
thanks JM, I understood the >> operator but I am little confuse about >>> operator & the negative part. Could you please explain that.
Thanks
Ketu