1. mypackage.MyClass cannot be cast to mypackage.MyClass forums.oracle.comI guess, my problem is that I have 2 jar files, both containing the same packages but some different versions of classes. They do not need each other, it just happens the VM did not unload the first jar file while I'm now using the other version (my guess). I know that "MyClass" is the same in both jar files, a ... |
2. Help with "down casting" forums.oracle.comSurely (or should that be Shirley?) it must be a fairly common situtation to not always know what the final description of an object will be. When the object is slowly built up over stages (or in Java made more specific) and at each stage there are multiple choices as to how the description can change. I would have thought that ... |
3. Is there a way to cast a string to a stringTokenizer forums.oracle.com |
4. FORCE CASTING forums.oracle.comHi as you i+=d is equal to i=i+d so please explain me why the first code 'A dont work and 'B does?. A. { public class PlusExample { public static void main(String[] args) { int i = 0; double d = 1.0; i = i + d; System.out.println(i); } B . { public class PlusExample { public static void main(String[] args) ... |
5. What is casting? forums.oracle.comThe real answer is that as the GUI toolkit was expanding, adding features like AffineTransforms, Composites, Strokes and rendering hints, the designers decided to express these new features in subclass Graphics2D rather than by changing the existing class Graphics so extensively. That was a choice they made. But there were still methods like paint which had a parameter of the original ... |
6. casting forums.oracle.com |
7. casting forums.oracle.com |
8. Need Clarification about Casting in Java forums.oracle.comHere is the question, class Alien{ String invade(short ships) { return "a few"; } String invade(short... ships) { return "many"; } } class Defender{ public static void main(String [] args) { System.out.println(new Alien().invade(7)); } } The answer is compilation fails because argument 7 needs to be cast to short. Now my doubt is that as short is 16 bit in Java ... |
9. Help with Cast forums.oracle.comI realize the following: int i = a.size(); while( i-- > 0 ) Integer[] elementRef = (Integer[])a.get( i ); but I was wondering if it would be possible to avoid the a.size() number of casts. ArrayList |
10. Cast works wrong forums.oracle.com |
11. cast forums.oracle.com |
12. casting forums.oracle.com2) Casting is used among objects which are related to each other in the inheritance tree otherwise compiler error(inconvertable types) will be thrown. How these primitives are related? since their wrapper classes are not in same inheritance tree. They are not related to each other. How is this casting possible among primitives? |
13. Casting and For Each loop? forums.oracle.comThats exactly what I was looking for mate. Argh getting used to this Java syntax is a quiet something. I have to have two seperate methods one for setting my variable and one to get its value. In .NET you could have it so that I could get and set the property in the same method. I hope Java includes this, ... |
14. Why is this cast refused? forums.oracle.com |
15. casting forums.oracle.com |
16. Cast to JarURLInputStream when reading jar img resources forums.oracle.com |
17. casting?? forums.oracle.com |
18. Casting forums.oracle.com |
19. simple cast forums.oracle.com |
20. Cannot cast from ActionForm to StudentForm forums.oracle.comAre you under the impression that you can just cast from any object type to another? You can't. So unless the actual object type passed to that method really is a StudentForm object (or a subclass of StudentForm), you can't just willy-nilly cast it and expect it to work. Thanks for the reply again I think i am getting what u ... |
21. remoteagent.GenericRequest cannot be cast to remoteagent.ModifyObjectReques forums.oracle.com |
22. Casting practice forums.oracle.com |
23. casting forums.oracle.com |
24. How to cast a string to color? forums.oracle.com |
25. Casting Probelm. Dunno What to Do forums.oracle.com |
26. Is it possible the following cast? forums.oracle.com |
27. Need advice on casting...? forums.oracle.comI have alot of these kinds of methods (see below). They all take ARRAY objects although the object they are cast to (ListElement in the example below) can be different. I am looking to write a generic method to do this. I figured i could use Class.forName() to pass in the class to cast to but i dont know what to ... |
28. Unnecessary cast ? forums.oracle.comStretching my powers of speculation to the extreme, the person may have thought that to get B's overriding versions of methods implemented in A an overridden in B, you need to have a reference of type B. This is wrong, of course, but after putting in the do-nothing cast, and seeing the behavior he expected (B's version of the methods gets ... |
29. Casting a Component as JTextComponent forums.oracle.com/** *Filters the specified components according to their class type * *@param type The subtype of {@code Component} that should be allowed * in the returned array. *@param comps The {@code Component}s to filter. *@returns an array containing only components that are of the specified * type and in the specified array. */ |
30. reflective cast forums.oracle.comHi I'm making an equals metode, and since a few other classes are extending this class I would rather make the equals metode reflective instead of overriding it in every class. public boolean equals(Object otherObject) { if (this == otherObject) { return true; } else if (getClass().equals(otherObject.getClass())) { //instanceOf not used since a class and it's subclass cannot be equal. //need ... |
31. How to make casting..... forums.oracle.com |
32. Casting Problom forums.oracle.com |
33. casting forums.oracle.com |
34. Casting across jar boundaries forums.oracle.comBasically: I have 2 jars, the first a driver loads classes from the test jar. There is an interface TestResult GetTestResult() that the test jar implements to return back a subtype of TestResult. i.e. IPerfTestResult extends TestResult. Later on the driver calls back into the TestJar passing the TestResult it received above and the method tries to downcast from a TestResult ... |
35. Casting issue forums.oracle.comHello Forum, I am retrieving records from myslq database to oracle database, in mysql, i have a date field and a time field for each record, in oracle i have a timestamp field, what i am doing is extracting the two mysql fields, then parsing to a java.util.Date and finally passing that to the destination database as a java.sql.date type. currently ... |