Thanks & regards, Srini
MCP, SCJP-1.4, NCFM (Financial Markets), Oracle 9i - SQL ( 1Z0-007 ), ITIL Certified
Thanks & Regards<br /> <br />-Srikanth
Thanks & regards, Srini
MCP, SCJP-1.4, NCFM (Financial Markets), Oracle 9i - SQL ( 1Z0-007 ), ITIL Certified
Originally posted by Srinivasa Raghavan:
You should get errors in both the following lines
c = b; // 1
s = c * b; //4
In first line a byte variable cannot be assigned to a char because
char cannot have negative values.
In the 4th line the result of any arithmetic operation is an int , but it's assigned to a shot and hence the error.
import java.util.*;
public class Test1{
public static void main(String a[]){
Set s = new TreeSet();
s.add(new Person(20));
s.add(new Person(10));
System.out.println(s);
}
}
class Person{
Person(int i){}
}
****************************why above code is giving ClassCastException?
Regards<br />Sandy<br />[SCJP 5.0 - 75%]<br />[SCWCD 1.4 - 85%]<br />------------------<br />Tiger, Tiger burning bright,<br />Like a geek who works all night,<br />What new-fangled bit or byte,<br />Could ease the hacker's weary plight?
Thanks & regards, Srini
MCP, SCJP-1.4, NCFM (Financial Markets), Oracle 9i - SQL ( 1Z0-007 ), ITIL Certified
Originally posted by Srinivasa Raghavan:
Where is the question posted by Hema ?
She has posted another question in the same thread .. I replied to it .. Also Srikanth reddy replied to it .. Now what happened to the source ?? May be she has deleted..
Regards,<br />Seb<br /> <br />SCJP 1.4
Originally posted by Sara Olsen:
No, you answered this question first, and then it seems like you answered another question as well in this thread
Thanks & regards, Srini
MCP, SCJP-1.4, NCFM (Financial Markets), Oracle 9i - SQL ( 1Z0-007 ), ITIL Certified
Originally posted by srikanth reddy:
hi,
i have compiled the program ...both options 1 and 4 are wrong ...i suppose there is something wrong with the answer.....
thanks
sri
Thanks & regards, Srini
MCP, SCJP-1.4, NCFM (Financial Markets), Oracle 9i - SQL ( 1Z0-007 ), ITIL Certified
Regards<br />Sandy<br />[SCJP 5.0 - 75%]<br />[SCWCD 1.4 - 85%]<br />------------------<br />Tiger, Tiger burning bright,<br />Like a geek who works all night,<br />What new-fangled bit or byte,<br />Could ease the hacker's weary plight?
Thanks & regards, Srini
MCP, SCJP-1.4, NCFM (Financial Markets), Oracle 9i - SQL ( 1Z0-007 ), ITIL Certified
Thanks & Regards<br /> <br />-Srikanth
Originally posted by Srinivasa Raghavan:
Thats why bartenders insist not to post different questions in the same Thread. This wastes time ...
Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Bring out your dead! Or a tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
|