Any good article about reference variables casting ...

Hi,
I am looking for a good and simple article on the reference variables downcasting (and yes I am searching the Internet too so please do not suggest that).
Please let me know if you know of any good article or if you can explain it well as I am having hard time to figure out when it is right and when it is used incorrectly.
Thanks,
Pritchard

Casting conversions are "right" when you need a reference of the particular type AND the underlying object is type-compatible with the declared variable.
"Downcasting" example:
Object o = new Object();
String s = (String) o; // BAD! The underlying object is not an instance of String
Object o = "foo";
String s = (String) o; // Okay.~

Similar Messages

  • Any good articles or case studies on using MS technologies for BYOD in education settings ?

    Looking to see if any good articles or case studies on using MS technologies for BYOD in education settings ?  (schools, colleges etc)

    Check if this helps:
    http://www.microsoft.com/en-us/download/details.aspx?id=39681
    Yuri Diogenes [MSFT] - http://blogs.technet.com/yuridiogenes

  • Pretty Good Article about Arch Linux

    I thought this was a pretty good article about Arch; just wanted to share.  Apologies if this has already been posted. 
    http://www.h-online.com/open/features/A … 43717.html

    karol wrote:
    lifeafter2am wrote:
    I thought this was a pretty good article about Arch; just wanted to share.  Apologies if this has already been posted. 
    http://www.h-online.com/open/features/A … 43717.html
    It has been already posted in the wiki https://wiki.archlinux.org/index.php?ti … did=155441 , but I haven't seen it on the forums.
    You know I didn't even think to look there ..... I think the wiki quite literally has EVERYTHING! 

  • Any good articles on browser technology ?

    Hello everyone,
    Can someone recommend me some good articles on browser technology ?
    I would like to know more about this in order to do better user interface design.
    Thank you in advance !
    Rachel

    Err...
    Good interface design is somewhat independent of browser technology. Or more precisely, you should be thinking about the simplest, most intuitive way for a customer to perform a task and then determining if the technology can support it, not the other way around.
    I realize that in some corporate settings, you are kind of locked into a specific technology and need to come up with the best user interface that fits. Unfortunately, this does result in problems and unnecessary work, and generally, you won't be able to avoid it if technology is the primary focus.
    In any case, pretty much the best user-interface "tutorial" that I know of is http://www.webpagesthatsuck.com. What they do is look at a bunch of well, really bad sites, and criticize them in such a way that you learn what not to do, and why.
    I don't really think there is a similar best browser technology web site, because there are always multiple ways to code/present something and which method is best is a matter of personal preference. For example, ASP and JSP do almost functionally the same thing, and people tend to pick one or the other based on their familiarity with the syntax (Java verses VisualBasic).
    Fortunately, the list of available technologies is rather short such that you can easily evaluate them and determine which is best suited to your needs. Off the top of my head, JavaScript and various Macromedia technologies (Flash, Shockwave) are pretty much the only universally accepted client-side technologies. VRML is also available, but not very commonly used.

  • Any recent articles about ADF Faces Next ?

    I didn't find any current links about this new version of ADF Faces which will be like Google Web Toolkit.
    Did anybody some new things about it?
    I found only one good link about this new stuff, but it is from year 2005:
    http://www.it-eye.nl/weblog/2005/07/20/jsf-ajax-adffacesnext

    Hi,
    we will provide articles as we get closer to the production or any pre-release state. Once we have the components out we will provide in depth examples and discussions.
    Frank

  • Any good article on Java Interface usage principle?

    Hi All
    I find Java interface is quite good concept, but some expert mentioned in some article, "Don't over use it".
    Just wonderring anyone can point me to some good article on the internet on In what kind sceniaro we need use Interface, in which case we'd better not use it.
    Thanks in advance.
    Steven

    Then how do you explain some gurus said" don't overuse interface"?I explain it thus:
    (a) it doesn't actually contradict what the article says
    (b) 'don't overuse interfaces' is a tautology: it doesn't actually say anything very useful.
    On the other hand there's no reason why "some gurus" can't disagree with Holub. I disagree myself to a large extent. You can define your entire API as interfaces, but then you're committed to all kinds of factory methods, and provision of secret implementation classes, etc. This can get pretty tedious pretty quickly. And, somewhere or other, you must have at least one actual class, so that you can have either a static method or a constructor, so you can get hold of your initial factory, or factory builder, or factory builder factory, or factory builder factory builder, or wherever it is that you want to start.
    I've used frameworks where there were four different implementation classes for the same interface. Never did find out why. Something wrong somewhere.
    When you can keep your base classes stable, I don't see a reason not to use them. 'Base class fragility' is all that Holub is really complaining about, and there are lots of solutions to that, such as 'don't' for a start. Java is chock full of stable base classes.

  • Any good articles on podcasting?

    I work in the training department of a Federal agency. One of our department's goals for 2008 is to "do podcasting". Those involved are planning to select, what I consider to be, rather random topics. I thought that a podcast involved a series of episodes, like lectures from a semester long class. Also, their planned podcasts won't be what I call educational, but more informational.
    Anyway, I would love some good articles or whitepapers on podcasting including what kinds of things/topics are best.
    Gary
    p.s. I think they are planning on placing each podcast in our LMS as a learning object, and/or emailing the MP3 as an attachment to everyone. I know itunesU is not a consideration (yet!).

    I have been working with podcasts shortly after its conception a few years ago and I still have difficulties trying to explain the concept to people that never heard the word. A good starting point is wikipedia and Apple.
    +This is the wikipedia alrticle:+
    http://en.wikipedia.org/wiki/Podcasting
    +Here are a few Apple primers:+
    http://www.apple.com/itunes/store/podcasts.html
    http://www.apple.com/itunes/store/podcaststips.html
    +David Pogue explains it here in this simple and fun video:+
    http://videos.howstuffworks.com/science-channel/7375-podcast-primer-video.htm
    +Here they have various articles if you search for the keyword "podcast":+
    http://www.powertolearn.com/articles/parentingwithtechnology/article.shtml?ID=7
    You will find out that the key of a podcasting is the subscription model's delivery method via an RSS feed. Something not possible by just placing files in a server or by emailing attachemnts.
    The best way to understand it is to experience it. You can refer people to the iTunes store (assuming they have iTunes installed) and have them search and subscribe to a couple of audio and video podcasts based on their job responsibilities or hobbies. You can also subscribe to most iTunes U classes for free.
    Podcasting is an amazing communication medium. I now have two video podcasts and next week will also have a third audio program before summer ends. Those are personal projects but now I am helping large companies and organizations to create their own podcasts, mainly for educational purposes (aka training). Hope this helps.

  • Any good article on Singleton design pattern recently updated.

    Hi,
    Can anyone suggest me a good article on Singleton design pattern recently updated..?
    Thanks in advance.

    Check out the following Singleton Design Pattern Tutorial
    http://www.beginner-java-tutorial.com/singleton.html

  • Confusion about reference variable

    Still, I am sometimes an incurable complete newbie. The code A works but I feel repeating same comparisons is somehow awkward. But, much simpler code B fails in inserting a new node in a tree. Could you explain what is happening here in Java backstage?
    //[code A]
    // code that works
    while (p != null) {
      prev = p;
      if (p.compareTo(newnode) < 0){
        p = p.right;
      else{
        p = p.left;
    if (prev.compareTo(newnode) < 0){
      prev.right = newnode;
    else{
      prev.left = newnode;
    //[code B]
    // code that fails
    while (p != null) {
      if (p.compareTo(newnode) < 0){
        p = p.right;
      else{
        p = p.left;
    p = newnode; // p is original p, p.right or p.left
                 // == prev, prev.right or prev.left on above code

    Case A:
    you hold the reference of the last node in "prev". so after completing the traversal ur "p" becomes null and "prev" hold the exact leaf position to add the new node.
    for which u used prev.right or prev.left to store the reference of the new node.
    Case B:
    U traverse correctly but do not hold the reference of the leaf , which will store the new node.
    In this case u will never be able to add a new node. as u had lost the reference which will store the new node.
    I think u are confused,bcoz u think that in case of b , "p" is the right position to store the new node and assighing new node to p will work.
    but think when u set new node reference to p that reference is not hold by any of the tree node (as reference are stored in <leaf>.right or <leaf>.left).
    I think this will make u understand the holding of reference in the tree.

  • Doubt in reference variable casting

    10. interface Foo {}
    11. class Alpha implements Foo { }
    12. class Beta extends Alpha {}
    13. class Delta extends Beta {
    14. public static void main( String[] args) {
    15. Beta x = new Beta();
    16. // insert code here
    17. }
    18. }
    Which code, inserted at line 16, will cause a
    java.lang.ClassCastException?
    A. Alpha a = x;
    B. Foo f= (Delta)x;
    C. Foo f= (Alpha)x;
    D. Beta b = (Beta)(Alpha)x;
    Doubt:
    ClassCastExecption will come when we insert "B" option. My doubt is , how can we cast the beta object as "Alpha" and then "Beta" (Ref D option). Please explain in detail why the option D will not throw ClassCastExecption.

    MyBugs_Bug wrote:
    Doubt:
    ClassCastExecption will come when we insert "B" option. Hi, this looks like an SCJP question, eh.
    class Delta extends Beta {}
    Beta x = new Beta();
    Foo f = (Delta)x;This will cause CCE because "all Delta are Beta but Not all Beta are Delta", right? E.g all rectangles are shapes but shapes are Not necessary Rectangles. So, you cannot cast a rectangle into a shape.
    MyBugs_Bug wrote:
    My doubt is , how can we cast the beta object as "Alpha" and then "Beta" (Ref D option). Please explain in detail why the option D will not throw ClassCastExecption.
    class Beta extends Alpha {}
    class Delta extends Beta {}
    Beta x = new Beta();
    Beta b = (Beta)(Alpha)x;(Alpha)x will not throw CCE because all Beta are Alpha. Yes? So Beta b = (Beta)(Alpha)x is legal and is perfectly okay.
    P/s: If there are any errors in my reply, please correct me. Thank you.

  • Any good blog about DMZ, DNS and other network concepts?

    We get a project with a lot of network technology.
    We are looking for a good book or blog explaining  the network concepts
    such as port forwarding, proxy, DMZ, DNS, etc.
    Any help is appreciated.
    Thanks!

    Hi,
    Go through the below link. It may be helpful
    http://www.zytrax.com/books/dns/ch4/
    Regards,
    Bharath.

  • Any GOOD things about the WRT300N?????

    I understand that these forums are good sources of information for solving problems.  However, ALL I can find are problems with the WRT300N. 
    I just bought one and I plan on installing tomorrow to support a new wireless 11g printer I bought and to give me more headroom for gaming.
    All the posts cite connections dropping, poor performance, and lack of range.  Is anyone "pleased" with this router???
    Should I just put it back without even trying to install and get my money back????
    Thanks.

    Jag,
    I've only owned the 300N for a few days, but it's been stable and an easy connection with a Windows Vista machine. I struggled with an older NetFear router with a new Vista machine and gave up after 4 days of stress and frustration and bought the 300N with the USB300 series adapter on a whim while shopping.
    I've been getting 4-5 bars and according to Vista's connection information, averaging 210-250 mbps. The wireless PC is located upstairs on the second floor and the wireless router is on the first floor in my audio room. Just take note, there are not any "G" devices on the network.
    I had 2 issues with the router which I will explain.
    I contacted Linksys's level 1 tech support to deal with these 2 issues The security light light on the router was not lit and I asked why considering I had all security features enabled. MAC filtering, blocking SSID and encryption. The tech told me that if you use the Easy Link software the security light will not light. To activate the security light, you need to use the Linksys Wireless Network Monitor software to activate the security light. Unfortunately, Vista does not support this software, so if using Vista, according to the tech, it will never light until they have a fix, if they create one at all.
    The other issue I had was not broadcasting the SSID. When I disengaged the broadcast function, I could not connect to the network. I tried various methods and I initially looked for the Wireless network monitor software, but it was/is not available with the Vista firmware. To connect to the router with the broadcast of the SSID off, she had me delete the current profile, create another manually adding the network SSID, encryption type, etc., and now I can connect to the network with not broadcasting the SSID.
    Perhaps my situation is an anomaly, but I have not dropped a connection yet, speed has been 5 X my NetFear "G" connection speed and I receive 4-5 bars for signal strength. I did notice that when I changed the Network Mode to "N" band only and changed a few other settings following the manual, the signal dropped to 3 bars. I just switched back to the "Mixed" mode and default settings and the signal went back to normal.
    I'm not a complete neophyte with wireless, but generally once it's secure (if there i such a thing) and connected, I never touch it again except to change the network name, router password, etc every few months. That is my experience.
    Much luck, Charles
    Message Edited by mozvz on 12-31-2007 07:17 PM
    Message Edited by mozvz on 12-31-2007 07:33 PM

  • Any good book about LabIVEW for IMAQ Vision?

    I am very new to IMAQ vision (LabVIEW). I tried to read all of the tutorial on the NI web page, but it doesn't help that much. Is there any book recommended for the beginner (LabVIEW for IMAQ)? What I have to do with IMAQ is to write a program to measure distance, identification part whether it's present or absent, and measure angles.

    If you're new to IMAQ Vision, your best bet is to take one of the Machine Vision and Image Acquisition courses offered through National Instruments. Go to www.ni.com/custed to find a course being offered in your area. Another option is to use Vision Builder which is a great tool for beginners because it lets you test most of the functions and prototype your application. When you're done, Vision Builder will build the LabVIEW code for you. If all else fails, go to www.ni.com/ask and email us some example images. We might be able to build some example programs for you. (no promises, though)
    Kyle V
    Applications Engineer
    National Instruments

  • Is There ANY Good News About The Update To iOS5 ?

    So I haven't updated my iPhone 4 to iOS5 yet. Before I do, I went to read about how it is working for others, and JESUS !!! What a nightmare it looks like.
    So now I am completely nervous to do it and may want to wait. So I ask if I should and if indeed these nightmares are valid and universal to everyone ? Or is anyone out there actually experiencing no problems with the update ? So therefore is it "hit and miss" with these issues I am reading about ?
    Please help with some advice, as I would love to be "up to date", but hate quirky bugs and glitches, etc...
    Currently on a 16GB iPhone 4 (not a S) with iOS 4.3.5
    Thanks in advance for your advice -

    Most have no issues.
    I have never had an issue nor has anyone I personally know.
    Every single update, without exception, is met with some complaints.  Just as a hospital is full of sick people, this support forum is full of people who need support.
    The majority of users have no isse and therefore do not post on the internet or in support forums.

  • Any good books or reference to get the full features/understanding of APEX

    Hi buddy,
    Any suggestion on book or www ? I am very much interested to know very single items on APEX especially on the latest version 3.1 ?
    Many thanks in advance.

    Hello,
    I would go for the online APEX documentation: http://www.oracle.com/technology/products/database/application_express/html/doc.html
    Especially if you want a quick start, the 2 day developer guide is useful.
    Regards,
    Dimitri
    -- http://dgielis.blogspot.com/
    -- http://apex-evangelists.com/
    -- http://apexblogs.info/

Maybe you are looking for

  • Macbook wont charge

    Hello again I'm going to try my luck again for asking for help here I'll try to keep it short and simple. What's Wrong With My Mac??? It won't charge or show the led color on the charger. The battery indicator flashes. "don't know what it means thoug

  • Spam contact requests

    I have had a Skype account for several years, I have never had so may spam contact requests as in recent months. I have the highest privacy settings and always report and block spam. It still comes through - often with the same photos and message req

  • How to use these different views?

    Hi Experts, Out of curiosity;I would like to know, Why we have four different types of views in UI5 application development? What type of view should be considered in development and why? Does each of them have any significance in the whole applicati

  • How come ITunes says I purchased a song, but I can't find it in any library

    How come ITunes says I purchased a song, but I can't find it in any library

  • Custom Apex theme prohobits CSV Download link

    Hi, I'm using Apex 3.2.1.00.12; Database version = 11.1.0.7.0. A customized theme is used for the application. For a reports region I added CSV Download link, but it is not showing when i run the page. Please let me know if any settings to be changed